Hi,
I have the following texts :
#1#http://www.google.com#2#Google#3# #1#http://www.aol.com#2#AOL#3#
I need a bash script which extracts the text between the markers (marks are #1#,#2#,#3#). I also need that text in variables ($URL and $DESCRIPT will be fine) so I can later use it to construct a SQL statement.
Thanks in advance.
write a bash:
for I in $* do echo $I t=$I t1=${t%%#2#*} t1=${t1##*#1#} t2=${t%%#3#*} t2=${t2##*#2#} echo $t1 echo $t2 done
call the shell like this: ./b.sh `cat tmp.txt | awk /#1#/`
or use: awk -F# '/#1#/{print $3,$5}' tmp.txt
awk 'BEGIN{FS="#"} {url[$0]=$3;des[$0]=$5;} END{ for (i in url) printf("The URL for %s is: %s\n",des,url); } ' filename