![]() |
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 Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| deleting a line but keeping the same file | laiko | UNIX for Dummies Questions & Answers | 2 | 05-13-2008 02:08 PM |
| Need to serach if a new line character exists on the last line in a file | sunilbm78 | UNIX for Dummies Questions & Answers | 10 | 02-29-2008 02:15 PM |
| Deleting Junks at the end of each line in a file | dave_nithis | UNIX Desktop for Dummies Questions & Answers | 5 | 10-05-2007 02:51 AM |
| Problem deleting file with special character | hart1165 | UNIX for Dummies Questions & Answers | 2 | 12-07-2005 11:29 AM |
| Deleting end line spaces for along file | osymad | Shell Programming and Scripting | 3 | 02-23-2005 01:56 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Deleting end of line $ character in file
Hi, I've got a file where in the middle of the record is a $ end of line character, visible only when I open the file in vi and do :set list. How to I get rid of the character in the middle and keep it at the end. The middle $ character always appears after SW, so that can be used to tag it.
Normal row - Field 1, Field2,Field3, Field 4$ Bad row - Field 1, Field2SW$, Field3, Field 4$ |
|
||||
|
Hi Ranjithpr;
I'm not getting the results I want... is there someway to tell the script to remove the $ character immediately after the SW and combine the two lines together. Thanks so much for helping out. |
|
||||
|
Do the following within the file to remove SW$ .
:g/SW\$/s/// Then you can apply rangithpr's suggestion to give you a final fix awk '{ if(substr($0,length)==",") printf("%s ",$0); else print }' filename Last edited by jxh461; 01-08-2008 at 01:24 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|