This is a discussion on C shell scipts within the Shell scripting forums, part of the Development/Scripting category; searches for all phone numbers of the forms xxx-xxx-xxxx (x is any digit) in a document file and removes the ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
searches for all phone numbers of
the forms xxx-xxx-xxxx (x is any digit) in a document file and removes the area code. phonebook generates a file called phonelist (with one phone number per line) which contains all the phone numbers it has found in the document. |
| Sponsored Links | ||
|
|
|
||||
|
Assuming that your file looks like as follows:
FILE.TXT Code:
123-1122-99959 123-122-99949 123-12-99929 123-11-9999 Code:
awk -F'-' '{ print $3 }' FILE.TXT > output.txt
Code:
awk -F'-' '{ print $2"-"$3 }' FILE.TXT > output.txt
Code:
less output.txt
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| writing a shell script to find out my shell name | jaymob123 | Shell scripting | 1 | 10-08-2007 01:36 AM |