![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To remove new line character | shihabvk | UNIX for Advanced & Expert Users | 7 | 06-18-2009 07:44 AM |
| Vi single character change | Brett Taylor | Shell Programming and Scripting | 6 | 08-30-2006 02:07 PM |
| remove single-line comment | Icy002 | High Level Programming | 3 | 04-09-2006 08:30 AM |
| reading a single character in C | alodha | High Level Programming | 3 | 01-28-2005 06:22 AM |
| Remove Last Character of Line | danhodges99 | Shell Programming and Scripting | 4 | 05-21-2003 09:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Here is a sample code
grep '903' -i user.txt | tail -2 | awk '{print $2}' | sed 's/B//g' the input file has data as such 903-xxx-xxxxB 903-xxx-xxxxB It is a dialer file i want to remove the "B" any help thanks |
|
||||
|
this code is already working
can you please explain what do you wanna remove
because your code Quote:
so is there anything else you want to remove |
|
||||
|
Quote:
Code:
awk '/^903/{gsub(/B$/,"")}{print}' user.txt
|
|
||||
|
character removal
xander, yes the code works but it doesnt terminate if locks up and it also doesnt change the source file. that is what i want to accomplish.here is the part of the file as it apears.
RPNUM: 903-310-7076B i want to remove the 'B' so the dialer can call the num my way will remove the num from the output but not the source file also it freezes. the other examples didnt seem to works thanks everybody |
|
||||
|
update on Ghostdog usage
thanks for your help.
some of the problems i was having was removing the B from the DOB line. along with the B from the Phone nums. HOME# cat user2.txt PT: DARRELL SMITH PTDOB: 12/15/98 RP: DARRELL SMITH SR PTSSN: 558-55-1234 RPSSN: 554-55-1234 HMNUM: 213-555-1234B RPNUM: 213-555-1234 POENUM: 213-555-1234B HMADDY: 123 A yourstreet Los Angeles CA 90504 POENAME: POEADDY: CLIENT: TMC DOS: 05/07/05 After trying many diff things i changed ghostdog's example and viola awk '//{gsub(/B$/,"")}{print}' user2.txt and now th results are in HOME# awk '//{gsub(/B$/,"")}{print}' user2.txt PT: DARRELL SMITH PTDOB: 12/15/98 RP: DARRELL SMITH SR PTSSN: 558-55-1234 RPSSN: 554-55-1234 HMNUM: 213-555-1234 RPNUM: 213-555-1234 POENUM: 213-555-1234 HMADDY: 123 A yourstreet Los Angeles CA 90504 POENAME: POEADDY: CLIENT: TMC DOS: 05/07/05 HOME# Thanks GDog |
| Sponsored Links | ||
|
|