- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripting! , how to do this ?
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
03-28-2006 08:34 PM
03-28-2006 08:34 PM
I have this : data1.txt
--------
44%
53%
77%
61%
1%
3%
45%
49%
------
How to get this out put like this:
-----
44
53
77
61
1
3
45
49
-----
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 08:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 08:40 PM
03-28-2006 08:40 PM
Re: scripting! , how to do this ?
You can use this command:
# cat data1.txt | sed 's/%/ /'
44
53
77
61
1
3
45
49
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 08:40 PM
03-28-2006 08:40 PM
Re: scripting! , how to do this ?
# awk -F"%" '{ print $1; }' < inputfile > outputfile
# cut -d"%" -f1 < inputfile > outputfile
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 08:41 PM
03-28-2006 08:41 PM
Re: scripting! , how to do this ?
# perl -pi -e 's/%//' filename
Lots of ways to do it.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 08:47 PM
03-28-2006 08:47 PM
Re: scripting! , how to do this ?
Muthu though # perl -pi -e 's/%//' filename , command not giving output. Rest all orking fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 08:49 PM
03-28-2006 08:49 PM
Re: scripting! , how to do this ?
perl -pi -e 's/%//' filename
will update in the file itself.
Example:
# cat filename
45%
35%
# perl -pi -e 's/%//' filename
# cat filename
45%
35%
It is not needing any temporary files to do this action.
If you don't want then simply as,
# perl -p -e 's/%//' filename (without -i)
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 08:51 PM
03-28-2006 08:51 PM
Re: scripting! , how to do this ?
# perl -pi -e 's/%//' filename
# cat filename
45
35
will remove % and update in the same file.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2006 09:04 PM
03-28-2006 09:04 PM
Re: scripting! , how to do this ?
Its working!!