Weird ^M characters is disturbing the paste command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Weird ^M characters is disturbing the paste command
# 1  
Old 10-08-2012
Weird ^M characters is disturbing the paste command

Dear all,
I have the files: xaa xab xac
and I try to paste them using $paste -d, xaa xab xac
I see:

output
Code:
3e-130
,6e-78
,5e-74
6e-124
,0,007
,0,026
2e-119

When I type: $ paste -d, xaa xab xac |less
I see:

output
Code:
3e-130^M,6e-78^M,5e-74
6e-124^M,0,007^M,0,026
2e-119^M,0,040^M,0,041
1e-82^M,0,19^M,0,069
3e-71^M,1e-77^M,0,13
3e-66^M,1e-77^M,0,43
2e-62^M,0,44^M,6e-84

Anyway, what is this ^M character? Is it disturbing the correct output from paste command? How can I figure out this problem?

NOTE: xaa xab xac are outputs of a python script.


Cheers.

Last edited by Scott; 10-08-2012 at 03:36 PM.. Reason: Code tags
# 2  
Old 10-08-2012
Code:
dos2ux infile > newfile

or
Code:
dos2unix infile > newfile

^M is carriage control, line feed control characted from Windows file interpreted in UX.
# 3  
Old 10-08-2012
It's a carriage return. This topic has been covered extensively:
The UNIX and Linux Forums - Search Results
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find out the weird blank characters?

I have a text file downloaded from the web, I want to count the unique words used in the file, and a person's speaking length during conversation by counting the words between the opening and closing quotation marks which differ from the standard ASCII code. Also I found out the file contains some... (2 Replies)
Discussion started by: yifangt
2 Replies

2. UNIX for Advanced & Expert Users

Weird output from ps command

Hi Guys, I am regular Solaris user. I came across a weird problem that puzzled me. Hope you guys can help. I found that process's state(command & arguments) in two different variants of ps command is different. Can anyone explain how is this possible? bash-3.2$ ps -eLo pid,s,comm,args |... (2 Replies)
Discussion started by: brij123
2 Replies

3. Shell Programming and Scripting

Control characters -weird problem

I am using Korn shell on Linux 2.6x platform , and I am suing the following code to capture the lines which contain CONTROL CHARACTERS in my file : awk '/]/ {print NR}' EROLLMENT_INPUT.txt The problem is that this code shows the file has control characters when the file is in folder A ,... (2 Replies)
Discussion started by: kumarjt
2 Replies

4. Shell Programming and Scripting

share a shell script which can replace weird characters in directory or file name

I just finish the shell script . This shell can replace weird characters (such as #$%^@!'"...) in file or directory name by "_" I spent long time on replacing apostrophe in file/directory name added: 2012-03-14 the 124th line (/usr/bin/perl -i -e "s#\'#\\'#g" /tmp/rpdir_level$i.tmp) is... (5 Replies)
Discussion started by: begonia
5 Replies

5. Solaris

Constant disturbing messages????

Hi friends, I am new to Solaris, I have just managed to install Solaris 10 under VirtualBox. As I use the system, I constantly get some very disturbing error messages on my screen, I hope you will help me remove them. Messages are # syslogd: line 24: WARNING: loghost could not be resolved ... (6 Replies)
Discussion started by: gabam
6 Replies

6. UNIX for Advanced & Expert Users

cat / sed process weird characters

Hi everyone, I'm trying to write a shell script that process a log file. The log format is generally: (8 digit hex of unix time),(system ID),(state)\n My shell script gets the file from the web, saves it in a local text directory. I then want to change the hex to decimal, convert from unix time... (7 Replies)
Discussion started by: bencpeters
7 Replies

7. UNIX for Dummies Questions & Answers

How to paste Kanji Characters into a Unix File

Hi, I am unable to copy Kanji characters into a unix file. They look like special characters when pasted into the Unix file. My objective is to copy these characters into a unix file and be able to print it and see the Kanji characters. Any help would be greatly appreciated. I am trying this... (1 Reply)
Discussion started by: andrussw
1 Replies

8. Shell Programming and Scripting

Weird Ascii characters in file names

Hi. I have files in my OS that has weird file names with not-conventional ascii characters. I would like to run them but I can't refer them. I know the ascii # of the problematic characters. I can't change their name since it belongs to a 3rd party program... but I want to run it. is there... (2 Replies)
Discussion started by: yamsin789
2 Replies

9. UNIX for Dummies Questions & Answers

How to get rid of all the weird characters and color on bash shell

Does anyone of you know how to turn off color and weird characters on bash shell when using the command "script"? Everytime users on my server used that command to record their script, they either couldn't print it because lp kept giving the "unknown format character" messages or the print paper... (1 Reply)
Discussion started by: Micz
1 Replies

10. Programming

disturbing problem with PRINTF() !!

hello everybody, here is my problem: ________________________________________ #include <stdio.h> int main() { int i=10; printf("value is %i",i); return 0; } _________________________________________ when i compile and execute, nothing appears on screen!! but if i replace the printf... (2 Replies)
Discussion started by: brain_processin
2 Replies
Login or Register to Ask a Question