- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: perl + csv
Operating System - HP-UX
1753483
Members
4117
Online
108794
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
тАО05-30-2011 12:25 PM
тАО05-30-2011 12:25 PM
Re: perl + csv
sed -i s/'^M'/""/ test.csv
Sorted :)
Sorted :)
Jesus is the King
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2011 12:54 PM
тАО05-30-2011 12:54 PM
Re: perl + csv
If i put this line in the script:
/bin/sed -i s/'^M'/""/ /home/peter/test/"0041"$TODAY".csv"
It gets interpreted as:
/bin/sed -i 's/^M//' /home/peter/test/004120110530.csv
And it doesn't remove the ^M from the file.
How to fix this ?
/bin/sed -i s/'^M'/""/ /home/peter/test/"0041"$TODAY".csv"
It gets interpreted as:
/bin/sed -i 's/^M//' /home/peter/test/004120110530.csv
And it doesn't remove the ^M from the file.
How to fix this ?
Jesus is the King
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2011 12:57 PM
тАО05-30-2011 12:57 PM
Re: perl + csv
Hi (again):
> Maybe paste is not that bad but it inserts ^M after the last column of the first file and before the first column of the second file:
Then your file contained the carriage return in the first place. 'paste' uses a tab character as its default unless you override it with '-d.
Since you asked about Perl, you could remove the nasty carriage-returns with:
# perl -pi -e 's{\r$}{}' file
...which will do an in-place update of 'file' ridding it of the pesky carriage-returns.
Regards!
...JRF...
> Maybe paste is not that bad but it inserts ^M after the last column of the first file and before the first column of the second file:
Then your file contained the carriage return in the first place. 'paste' uses a tab character as its default unless you override it with '-d
Since you asked about Perl, you could remove the nasty carriage-returns with:
# perl -pi -e 's{\r$}{}' file
...which will do an in-place update of 'file' ridding it of the pesky carriage-returns.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-30-2011 02:15 PM
тАО05-30-2011 02:15 PM
Re: perl + csv
>It gets interpreted as:
Are you using control-V control-M to insert the CR into the string?
sed -i -e 's/^V^M//' 004120110530.csv
Otherwise you can use echo:
sed -i -e 's/$(echo "\r\c")//' 004120110530.csv
Are you using control-V control-M to insert the CR into the string?
sed -i -e 's/^V^M//' 004120110530.csv
Otherwise you can use echo:
sed -i -e 's/$(echo "\r\c")//' 004120110530.csv
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP