- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to get rid of control M characters!!!!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 08:11 AM
08-08-2004 08:11 AM
how to get rid of control M characters!!!!
I am parsing a file and writing part of it to another file
echo $PATH "," >$outfile
I am getting a ^M character before "," in the outfile.. i checked the $PATH it doesnt have the character.. is there any way i could get rid of it in a script itself?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 08:17 AM
08-08-2004 08:17 AM
Re: how to get rid of control M characters!!!!
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 09:58 AM
08-08-2004 09:58 AM
Re: how to get rid of control M characters!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 10:02 AM
08-08-2004 10:02 AM
Re: how to get rid of control M characters!!!!
Check your terminal type. This is most likely the cause.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 02:04 PM
08-08-2004 02:04 PM
Re: how to get rid of control M characters!!!!
If original file name is aaa.sh.
# dos2ux aaa.sh > aaa.txt
2. Rename converted name to original file name.
# mv aaa.txt aaa.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 03:16 PM
08-08-2004 03:16 PM
Re: how to get rid of control M characters!!!!
stty raw
stty -raw
I haven't played w/ this in a while, but when you Terminal I/O is put into RAW mode, you should see the extra character ^M before the next-line is printed.
Unix uses ASCII '\n' to imply both line-feed and carriage-return. Well, in raw-mode, you see both the line-feed ascii and carriage-return ascii.
In dos, this is different. also, in unix, when you are in 'raw' terminal i/o mode, you see both of these in output files.
try a: cat -v
for more reading see: termio(7) and stty(1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 06:15 PM
08-08-2004 06:15 PM
Re: how to get rid of control M characters!!!!
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 08:54 PM
08-08-2004 08:54 PM
Re: how to get rid of control M characters!!!!
this typically happen when you FTP ascii file from windows ws. Then you have to dos2ux filename > file
on other hand in windows if you have squares instead of cr use ux2dos.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 09:06 PM
08-08-2004 09:06 PM
Re: how to get rid of control M characters!!!!
# cat filename | col -bx > textfile
This should also help.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 02:08 AM
08-09-2004 02:08 AM
Re: how to get rid of control M characters!!!!
sorry about that
any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 02:13 AM
08-09-2004 02:13 AM
Re: how to get rid of control M characters!!!!
:1,$:s/ctrl-Vctrl-M//
best regards,
Kent M. Ostby
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 02:15 AM
08-09-2004 02:15 AM
Re: how to get rid of control M characters!!!!
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 02:52 AM
08-09-2004 02:52 AM
Re: how to get rid of control M characters!!!!
echo "${PATH}." | sed 's/^M//g' > $outfile
to write ^M use ctrl-V ctrl-M
hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 04:14 AM
08-09-2004 04:14 AM
Re: how to get rid of control M characters!!!!
mv $FILE2 FILE1
Can use the tr command to delete the characters as well. The octal /015 is translated to the ^M character.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 06:55 AM
08-09-2004 06:55 AM
Re: how to get rid of control M characters!!!!
Sorry but doesnt help
My code
while read -r temp
do
Path="`echo $temp |awk '{print $4}'`"
echo $Path","$somethin>$outfile
done $1
In the outfile i am getting
/tmp/something^M,something
/tmp/something1^M,something1
/tmp/something2^M,something2
....
Later I read the outfile to use the Path
while read -r line
do
echo $line
done<$outfile
i am not sure whats wrong?
thanks for your help guys sirry didnt work ..
anything else i can try?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 07:51 PM
08-09-2004 07:51 PM
Re: how to get rid of control M characters!!!!
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 09:01 PM
08-09-2004 09:01 PM
Re: how to get rid of control M characters!!!!
You can know the change as,
--- in your script ---
Path="`echo $tmp | awk '{ print $4 }'`"
echo $path | od -dc
Path1="`echo $tmp | awk '{ print $4 }' | dos2ux`"
echo $path | od -dc
And more check this link to know more about the problem,
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=637940
It will work now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2004 03:32 AM
08-10-2004 03:32 AM
Re: how to get rid of control M characters!!!!
I think you have taken the i/p file
from windows.In unix carriage (^M) is not there.But in windows it has.when you copy any file from windows to unix this problem happens.
As per my opinion
dos2ux ip_file >op_file
is the best way
i have seen one perl script also .But right now i don't have
regards
vinod