How to add ^M (control M) in Linux


 
Thread Tools Search this Thread
Operating Systems Linux How to add ^M (control M) in Linux
# 1  
Old 05-11-2011
How to add ^M (control M) in Linux

I would like to add ^M (CTRL V CTRL M) to all lines of the file.
This is easy using unix2dos command in SunOS,
unix2dos commands appends ^M for all the lines in SUnOS
but I dont see the same beahaviou in Linux.

My files on Linu'x to be added with ^M at the end of each line.
is there any way to do this? or any alternatives like sed , awk ?

Thanks for your help.
Regards,
# 2  
Old 05-11-2011
Code:
 
sed "s/$/^M/" filename

This User Gave Thanks to 116@434 For This Post:
# 3  
Old 05-11-2011
What exactly are you not seeing? unix2dos works exactly as expected on Linux. If you want to check whether unix2dos has done it's job, one way is to use cat -v.
This User Gave Thanks to fpmurphy For This Post:
# 4  
Old 05-11-2011
He doesn't actually have it, is my guess.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I need to make a control panel for a Linux script

has anyone got experience using jsch? Does it give me a prompt when I run a command/ print result back to me. I need to send commands to a linux database like restart,shutdown,stop database caching etc. But in java I want to build a GUI I can use. TO call database commands. and do these... (3 Replies)
Discussion started by: Samuel12
3 Replies

2. Red Hat

Control M user permissions on Red Hat Linux

All, Requirement: Permissions Required for Control M on Linux I am using the Linux as the operating system. I am told to get an user configured for Control M on Linux. The user would be an authenticated user created by the client. The user created requires permissions to be made available so... (2 Replies)
Discussion started by: Roadies99
2 Replies

3. UNIX for Advanced & Expert Users

How can I remotely take unix/linux tty control!?

Hello everyone!. I am wondering if it is possible to take control of a tty session???!!!. For example: imagine you are running a command in a unix server that will take 12 hours to compleate... now, imagine you are at your home and you want to check how the command is performing or if errors... (2 Replies)
Discussion started by: dragonov7
2 Replies

4. Shell Programming and Scripting

How to add control statement?

Hi everyone, I have a script in which i need to add some codes.Right now my scripts takes table name from i/p file data.txt then matches it with data in another file table.if table exists then it searches for line cotaining "add" and extract column from there.Now i need to do additional part in... (0 Replies)
Discussion started by: alisha
0 Replies

5. Programming

How to control I/O in Linux?

Do anyone know how to program to control I/O - through RS 232? For example VC++, inport & outport. Any comment? (2 Replies)
Discussion started by: lcfoo
2 Replies

6. UNIX for Advanced & Expert Users

Access Control Lists for Linux (Redhat 7.2)

Hi, Does anyone know if Redhat 7.2 allows for file access control lists as you can in Solaris ? And if so, can you give me the basic command as I'm having trouble finding documentation on this. Thanx (1 Reply)
Discussion started by: ianf
1 Replies
Login or Register to Ask a Question