Search Results

Search: Posts Made By: nariwithu
1,710
Posted By RudiC
This may work, at least on your simplified...
This may work, at least on your simplified samples:awk '/<AAAA>/,/<\/AAAA>/ {X=X"\n"$0} /<\/AAAA>/ && X ~ /123456789/ {print X; X=""}' file

<AAAA>
abc
<id>123456789</id>
ddd
</AAAA>
1,710
Posted By MadeInGermany
X should be cleared at the end of every block ...
X should be cleared at the end of every block
awk '/<AAAA>/,/<\/AAAA>/{X=X"\n"$0}
/<\/AAAA>/ {if (X~/123456789/) print X; X=""}' file
Forum: Solaris 12-07-2006
123,753
Posted By Ygor
Try...nawk...
Try...nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=2 a=4 s="string" file1...where "b" and "a" are the number of lines to print before and after string "s".
...
3,365
Posted By mirni
This is not correct. These are three steps; you...
This is not correct. These are three steps; you have to run them one at a time:
./configurethen
makethen
make installAs for the garbled command... hmm... interesting. It is working ok, with my...
3,365
Posted By Scrutinizer
If there are no empty lines, you need something...
If there are no empty lines, you need something more complicated like this, or you can preprocess first like mirni suggested...
/usr/xpg4/bin/awk '$0~"<"resp{sect=1}
sect{p=p (p?RS:x) $0}
...
3,365
Posted By mirni
In your posted input, there is no 'response2',...
In your posted input, there is no 'response2', there is only 'reponse2'. Is this a typo, or is there really "reponse" in the input?
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 11:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy