![]() |
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 |
| rare problem -reinstalling formatting nothing is working | simaich8 | Linux | 0 | 11-04-2007 02:07 AM |
| formatting textfile inside ksh script using awk not working | tekline | UNIX for Advanced & Expert Users | 6 | 07-03-2007 01:40 AM |
| Substitution not working in ksh | arsheshadri | SUN Solaris | 3 | 04-12-2007 11:20 PM |
| Substitution not working in ksh | arsheshadri | AIX | 2 | 04-12-2007 07:30 AM |
| Var substitution in awk - not working as expected | videsh77 | Shell Programming and Scripting | 3 | 01-13-2006 01:57 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Formatting Substitution Command Not Working in vi
Unix Gurus,
I have a text file I have FTP'd to UNIX so that I can use it to load into our Baan system. When vi the file, I can see that there are formatting characters at the end of each line (^M). To get rid of these, I have read that the following should work: :%s/^M$//g - with the ^M being the equivalent of CTRL V CTRL M Unforutnately, when trying to type this command I can only get to the "CTRL M" before I get the error message "Substitute pattern match failed." Does anyone know why I cannot type the whole command shown above or is there something that cause the command to execute before the entire command is typed? Thank you in advance for your feedback. |
|
||||
|
Quote:
Definitely you would be able to do that! I tried and it works ( I doubt the ctrl -v and ctrl - m ) |
|
||||
|
Thanks for the Responses
Thanks Gurus! I never heard of or used DOS2UNIX so maybe I will try it sometime. I did take a look at my FTP settings and it was set on "Automatic." After changing it to "ASCII," I FTPd some files over that I had problems with in the past. Sure enough, no more problems with character formatting! I guess I assumed that "Automatic" would always give me the best method of moving the file.
I still would also be interested in knowing why I am not able to use the command %s/^M//g. The commands I am using to get the formatting character are ctrl v followed immediately by ctrl m. There is no use of the shift key, minus signs, plus signs, etc - only the ctrl button with the letter v follwed by the ctrl button and the letter m. |
|
||||
|
Nagarajan,
Your process is lengthy. I simply go for following echo "foo" >> file-name Then edit file using "vi" editor. your "^M" will be visible. Just remove that using compatible "vi" pattern-replacement method. Remember last-line "foo" and save file. Special attention is required in above make sure you use ">>" and NOT ">" otherwise its gone. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|