Hi frnd , hv nice week ahead,
in shell script i found 2 words as below
1 ) targ_found=`sed -n \`echo $line_no\`p sesslog.txt | grep -ic 'Targ Rowid'`
2 ) bracket_found=`sed -n \`echo $line_no\`p sesslog.txt | grep -wc ')'`
now we got he line number of 2 words. now i want to dispaly all the lines that resides between both the found lines. plz help in shell script or SED
$
$ # contents of my data file
$ cat data.txt
This is line: 1
This is line: 2
This is line: 3
This is line: 4
This is line: 5
This is line: 6
$
$ targ_found=2
$ bracket_found=5
$
$ # display all lines in data.txt between $targ_found and $bracket_found, both inclusive
$ sed -n ${targ_found},${bracket_found}p data.txt
This is line: 2
This is line: 3
This is line: 4
This is line: 5
$
$ # the same using perl
$ perl -ne "print if $.>=$targ_found and $.<=$bracket_found" data.txt
This is line: 2
This is line: 3
This is line: 4
This is line: 5
$
$
HTH,
tyler_durden