LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   help with sed (https://www.linuxquestions.org/questions/programming-9/help-with-sed-81059/)

DavidPhillips 08-11-2003 04:18 PM

help with sed
 
I have data coming in on a serial port, I need to remove the first part of each line.

the lines look like this...

~081 Continuity Error; SAR: 6418 Line: 119 Station: 566
~090 Time Start of Retrieval AUG 04 2003 12:24::48.83
~034 Time Break: .60msec
~031 Number of Vibs: 2 Vibs Stacked: Yes


lets say they range from ~000 to ~999


I can remove them independantly with this...

sed -e 's/^~081//'


what syntax can be used to remove any code ~??? at the beginning of the line

thanks,

crabboy 08-11-2003 04:34 PM

How about:
Code:

sed 's/^~...//'

crabboy 08-11-2003 04:37 PM

Quote:

lets say they range from ~000 to ~999
If the numbers are important:
Code:

sed 's/^~[0-9][0-9][0-9]//'

DavidPhillips 08-11-2003 04:46 PM

thanks,

looks like exactly what I need


All times are GMT -5. The time now is 10:44 PM.