Hi,
I have a text file like
Version=abc
Tab=1
URL GOTO=www.abc.com/board=1
some text...
I want to run a loop x no of times and append to the text file above text but
URL GOTO should be www.abc.com/board=2 then 3,4...etc till x.
Kindly help
Hi,
I have a text file like
Version=abc
Tab=1
URL GOTO=www.abc.com/board=1
some text...
I want to run a loop x no of times and append to the text file above text but
URL GOTO should be www.abc.com/board=2 then 3,4...etc till x.
Kindly help
You may not have spaces in variable names like in URL GOTO. This will not work.
You can try out this:
COUNTER=1
MAX=10
URL_GOTO="www.abc.com/board="
OUTFILE=bla.txt
while (( $COUNTER <= $MAX )); do
echo ${URL_GOTO}${COUNTER} >> $OUTFILE
let COUNTER=$COUNTER+1
done
$ cat test.file
Version=abc
Tab=1
URL GOTO=www.abc.com/board=1
some text...
for i in seq {1..100}
do
awk -v x=$i 'BEGIN{FS=OFS="="} /URL GOTO/ {$3=x}1' test.file >> OUTPUT.file
done