perl script- to read many values from xml file
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You already have all info you need in your $peermas. But if you need array of your IP addressed you may use: my @massipaddr = map { $_->{IPAddress} } @{ $peermas->{Appliance} };
|
How to read values from a text file and then find and replace the value in a xml file?
Tag : windows , By : Guy Kastenbaum
Date : March 29 2020, 07:55 AM
like below fixes the issue I have an .xml file - let's say A.xml. This file contains a "version node" , This should work: @ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
TYPE NUL>tempOutput.xml
SET line=0
SET from=
SET to=
FOR /F %%a IN (a.txt) DO (
IF !line!==0 SET from=%%a
IF !line!==1 SET to=%%a
SET /a line=!line!+1
)
ECHO replacing %from% with %to%...
FOR /F %%a IN (a.xml) DO (
SET currentLine=%%a
SET currentLine=!currentLine:%from%=%to%!
ECHO !currentLine!>>tempOutput.xml
)
DEL /q a.xml
MOVE tempOutput.xml a.xml
PAUSE
|
shell script to read values from one file and replace it in other file
Tag : json , By : mansoor
Date : March 29 2020, 07:55 AM
I hope this helps . Just explaining the comment of @user3159253. Your file1.config should look like this for your code to work properly: export ALERT_LEVEL=DANGER
export NORMAL_LEVEL=NORMAL
export RELAX_LEVEL=RELAX
sed file1.json -e 's/$ALERT_LEVEL/DANGER/g' -e's/$NORMAL_LEVEL/NORMAL/g' -e's/$RELAX_LEVEL/RELAX/g' >file2.json
|
How to read input from a user and replace a text in a .txt file with the inputed text on shell script?
Tag : shell , By : alexandruz
Date : March 29 2020, 07:55 AM
seems to work fine I am trying to read input from user and update a .txt file by replacing a word. Is there any possibility to do that? If there please help me. I want this to done using SHELL Script on Ubuntu OS. , You mean something like this ? #!/bin/bash
WORD="foo" # what to find
TXT_FILE="/tmp/lala.txt" # where
# get the new word from user
read -p "With what \"$WORD\" should be replaced ? " newword
# replace, preserving capitalization
output=$(cat "$TXT_FILE" | sed "s/${WORD^}/${newword^}/g" | sed "s/$WORD/$newword/ig")
echo "$output" > "$TXT_FILE"
echo "done"
/tmp » cat lala.txt
Foo is riding a bike, while Frank is sunbathing.
Suddenly, Foo falls. And also Foo, foo, foo.
/tmp » ./lala.sh
With what "foo" should be replaced ? bar
done
/tmp » cat lala.txt
Bar is riding a bike, while Frank is sunbathing.
Suddenly, Bar falls. And also Bar, bar, bar.
|
Shell script to read flat file and replace xml values
Tag : shell , By : UpperLuck
Date : March 29 2020, 07:55 AM
|