Search Results

Search: Posts Made By: pmennen
2,778
Posted By pmennen
And taking an idea from your 2nd example we get...
And taking an idea from your 2nd example we get two more equivalent versions that are still slightly shorter:

sed -n 's/,.*//; /key1/h; /key2/{H; x; s/^[^:]*: \|\n[^:]*://gp}' file

sed -n...
2,778
Posted By pmennen
My actual input file was a bit more complicated,...
My actual input file was a bit more complicated, and was similar to this:

....
??? key1: word1, word2, word3, word4
....
????? key2: word5, word6, word7
....
?????? key1: word8, word9
.......
2,778
Posted By pmennen
Thanks R. Singh (and sorry for forgetting the...
Thanks R. Singh (and sorry for forgetting the code tags).

Yes, I did simplify the problem somewhat for brevity, so I will probably have to learn at least some of that arcane looking awk syntax. (I...
2,778
Posted By pmennen
sed print flag
I have an input file that looks something like this:

....
key1: ABC
....
key2: DEF
....
key1: GGG
....
key2: HHH
....

The row of dots represents any number of lines that don't contain...
Showing results 1 to 4 of 4

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