Formatting Substitution Command Not Working in vi


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Formatting Substitution Command Not Working in vi
# 8  
Old 04-18-2007
hey i never tried this in vi but works for vim
just ^M character is carriage return ( which indicates file is in DOS format ) so just open file and do
:set fileformat=unix after that save file .
# 9  
Old 04-18-2007
Quote:
Originally Posted by ERPKEN
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.
So, the error msg denotes that your ctrl-v or ctrl-m is causing the "Enter" and since the pattern substitution is not complete thats why the error.

Is is possible that either ctrl-v or mostly ctrl-m is mapped to the "enter" or some key ?

Give us the output of "stty -a" and possible the "map" values in your .exrc file.
# 10  
Old 04-18-2007
^M is often enter, but it shouldn't make any difference. Once ^v is typed, the next char should be treated literally.
# 11  
Old 04-19-2007
Quote:
Originally Posted by reborg
^M is often enter, but it shouldn't make any difference. Once ^v is typed, the next char should be treated literally.
Agreed. Hmm .. can't think of anything else.
# 12  
Old 05-06-2007
dos2unix with col -b

To get ridge of ^M from dos first rename dos file to *.dos, then, use col -b

cat *.dos | col -b > original file name
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parameter substitution is not working with sed

I am trying add a prefix variable(string) to command output. sed parameter substitution is not working. - I have found some issues on my end of testing,, please delete this thread for now. (1 Reply)
Discussion started by: kchinnam
1 Replies

2. Shell Programming and Scripting

Simple Variable substitution in ksh not working

Hi Gurus, Not able to catch what's going wrong here. I just want to get output as "tree". server:/mk/app/nexapp $ echo $SHELL /usr/bin/ksh server:/mk/app/nexapp $ export db_name1="tree" server:/mk/app/nexapp $ export i=1 1st try: server:/mk/app/nexapp $ echo $(db_name$i) ksh: db_name1: ... (3 Replies)
Discussion started by: mukesh.lalwani
3 Replies

3. Shell Programming and Scripting

Bad substitution error while working with substring

Hi I'm using ksh. And i'm trying to get the substring like below. but giving the following error #!/bin/ksh foo=teststring bar=${foo:0:5} echo $bar And the error is ./sbstr_test.sh: bar=${foo:0:5}: bad substitution what is wrong in this script. Please correct me ... (3 Replies)
Discussion started by: smile689
3 Replies

4. UNIX for Dummies Questions & Answers

read command - using output from command substitution

Hey, guys! Trying to research this is such a pain since the read command itself is a common word. Try searching "unix OR linux read command examples" or using the command substitution keyword. :eek: So, I wanted to use a command statement similar to the following. This is kinda taken... (2 Replies)
Discussion started by: ProGrammar
2 Replies

5. UNIX for Dummies Questions & Answers

sed insert command and variable expansion/command substitution

I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename? #!/bin/bash filename=`echo $0` /usr/bin/sed '/#include/ { i\ the filename is `$filename` }' $1 exit 0 (8 Replies)
Discussion started by: glev2005
8 Replies

6. Linux

rare problem -reinstalling formatting nothing is working

i am not able to install solaris 10 i have installed solaris many times succesfully with wotking network after that abrupt power failure i was never able to start solaris and neither install during install it hangs IS IT PROBABLE THAT BIOS OR SOME OTHER SETTINGS RELATED TO HARDWARE IS... (0 Replies)
Discussion started by: simaich8
0 Replies

7. UNIX for Advanced & Expert Users

formatting textfile inside ksh script using awk not working

I cannot seem to get this text file to format. Its as if the awk statement is being treated as a simple cat command. I manned awk and it was very confusing. I viewed previous posts on this board and I got the same results as with the the awk command statement shown here. Please help. ... (6 Replies)
Discussion started by: tekline
6 Replies

8. Solaris

Substitution not working in ksh

Hi, Following code is working in bash but not in ksh. Can someone please send me an alternative? #!/bin/ksh fname="EOA.dmp" echo $fname logname=${fname/.dmp/.log} echo $logname I am getting below error in ksh "testcmd: logname=${fname/.dmp/.log}: 0403-011 The specified substitution... (3 Replies)
Discussion started by: arsheshadri
3 Replies

9. AIX

Substitution not working in ksh

Following code is working in bash but not in ksh. Can someone please send me an alternative? #!/bin/ksh fname="EOA.dmp" echo $fname logname=${fname/.dmp/.log} echo $logname I am getting below error in ksh "testcmd: logname=${fname/.dmp/.log}: 0403-011 The specified substitution is not... (2 Replies)
Discussion started by: arsheshadri
2 Replies

10. Shell Programming and Scripting

Var substitution in awk - not working as expected

countA=`awk '/X/''{print substr($0,38,1)}' fName | wc -l` countB=`wc -l fName | awk '{print int($1)}'` echo > temp ratio=`awk -va=$countA -vc=$countB '{printf "%.4f", a/c}' temp` After running script for above I am getting an error as : awk: 0602-533 Cannot find or open file -vc=25. The... (3 Replies)
Discussion started by: videsh77
3 Replies
Login or Register to Ask a Question