Hi
I have a text file which has two sets of lines repeating for "n" number of times.Some data is printed between the two lines.I want to retrieve all the data thats there in between those two set of lines.I have the string value of those two set of lines.
To be much more clearer
line1line1line1line1line1line1line1line1
datadatadatadatadatadatadatadat
datadatadatadatadatadatadatadata
line2line2line2line2line2line2line2line2
*
*
*
line1line1line1line1line1line1line1line1
data1data1data1data1data1data1
data1data1data1data1data1data1
line2line2line2line2line2line2line2line2
.
.
.
.this repeats for n number of times.
Pls help
Cheers
Vijay
Try this:
awk -v var1="begin_string" -v var2="end_string" '
$0==var1{f=0}
$0==var2{f++;next}f' file
Regards
Thanks a lot franklin.
But I get a syntax error at the semi colon part
Sorry ima perfect newbie to unix scripting:(
Use nawk or /usr/xpg4/bin/awk on Solaris
Regards
Hi
I managed to run it using another command awk '/string1/,/string2/'.
I have one more query...
I have a file which has values like the following..with a delimiter between sets of lines
Line1 value1
Line2 value1
Line 3 value1
------------
line 1 value2
line 2 value2
line 3 value2
will it be possibel for me to make a table sort of thing such that
underneath line 1..i have all values [value 1,value2] and underneath line 2 i have all the values
line1 line2
value1 value1
value2 value2
thanks for your time
Cheers
Vijay