![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need a regular expression | tony3101 | Shell Programming and Scripting | 4 | 06-05-2008 12:13 AM |
| regular expression | subin_bala | Shell Programming and Scripting | 1 | 04-29-2008 12:19 AM |
| Regular Expression matching in PERL | Legend986 | High Level Programming | 7 | 02-26-2008 01:43 AM |
| regular expression and awk | nickg | UNIX for Dummies Questions & Answers | 2 | 08-16-2007 02:23 PM |
| Regular Expression + Aritmetical Expression | Z0mby | Shell Programming and Scripting | 2 | 05-21-2002 07:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Regular expression matching a new line
I have written a script to test some isdn links in my network and I am trying to format the output to be more readable. Each line of the output has a different number of digits as follows...
Sitename , spid1 12345678901234 1234567890 1234567 , spid2 1234567890 1234567890 1234567 Sitename , spid1 12345678901234 1234567890 , spid2 12345678901234 1234567890 I would like to drop any string of either 7 or 10 digits and keep ony the 14 digit strings. I have attemted the following command but it gives me an error "Invalid preceding regular expression" sed 's/\<[0-9]\>\{7,10\}//g' oldfile > newfile Can anyone point me in the right direction to format this file? Thank you for the assistance. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Change the word/number boundary indicator to take in more numbers.
Code:
sed -e 's#\<[0-9]\{7\}\>##g' -e 's#\<[0-9]\{10\}\>##g'
Code:
sed 's/\<[0-9]\{7,10\}\>//g'
Last edited by vino; 12-12-2005 at 09:47 PM. |
||||
| Google The UNIX and Linux Forums |