sed
this is from my error log
01:37:17.872 newcomm:time out sending class %%c1360 to %%p41597 01:37:17.872 newcomm:time out sending class %%c1360 to %%p30103 01:37:17.872 newcomm:time out sending class %%c1360 to %%p26525 01:37:17.872 newcomm:time out sending class %%c1360 to %%p52258 01:37:17.872 newcomm:time out sending class %%c1360 to %%p26526 01:37:17.872 newcomm:time out sending class %%c1360 to %%p26526 01:37:17.853 newcomm:time out sending class %%c1360 to %%p35299 01:37:17.888 newcomm:time out sending class %%c1360 to %%p41755 01:37:17.888 newcomm:time out sending class %%c1360 to %%p41755 i printed out the last column with awk : casper@dots11> awk ' {print $8 }' newcomtime.txt %%p35299 %%p41597 %%p30103 %%p26525 %%p52258 %%p26526 %%p26526 %%p41755 %%p41755 then needed to take off the first three characters of each line ( %%p) to just get the pid I could not do it - i ended up modifying the file in kedit. I thought that this was the sed command to take off the first three characters - what does this sed command say - how could i have deleted the first three characters of each line casper@dots11> sed 's/\(...\).*/\1/ ' newcomlite %%p %%p %%p %%p %%p %%p %%p %%p %%p |
Just do it with 'cut':
Code:
$ < newcomlite cut -c 4- Code:
$ sed -e 's/^\%\%p//' newcomlite |
the cut is a good option,
I just thought that i was subsistuting the first three characters with blank lines with the s/\(...\) maybe there is a way i could delete the first threee characters with 'd' |
I'd guess the '%' sign isn't classed as a standard character and therefore isn't being matched by the '.' -- you'll have to check the 'sed' documentation to be sure though.
If it was you could catch it with -- sed -e 's/^.{3}//' |
Quote:
It is matching the "%" just fine----in your example, you are getting the expected output. rizhun's example above should work, except that it would need the -r flag: sed -e -r 's/^.{3}//' You could also use something like: sed 's/^%%.//' |
All times are GMT -5. The time now is 06:06 PM. |