- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Text Manipulation .
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
Forums
Discussions
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
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
09-01-2005 06:16 PM
09-01-2005 06:16 PM
I have a file : team1.txt
with the following details,
$ cat team1.txt
John
Christian
Veri
Ronald
------------
I want this to be show in this way ,
$ cat team1.txt
John Christian Veri Ronald
How can I do that , with the help of shell script.
Many Thanks ,
Veri.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 06:21 PM
09-01-2005 06:21 PM
Re: Text Manipulation .
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 06:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:00 PM
09-01-2005 07:00 PM
Re: Text Manipulation .
# perl -pe 's/\n/ /' team1.txt | perl -pe 's/$/\n/' > team1.txt
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:17 PM
09-01-2005 07:17 PM
Re: Text Manipulation .
You can use the tr command also to do that.
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:21 PM
09-01-2005 07:21 PM
Re: Text Manipulation .
The first post with awk command does not work . and giving same output.
Do you know how to get it thru awk also.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:38 PM
09-01-2005 07:38 PM
Re: Text Manipulation .
You can do this using the following tr command:
$ tr -s '/\n' '/ /' < team1.txt
Cheers ,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:42 PM
09-01-2005 07:42 PM
Re: Text Manipulation .
eg.
#!/usr/bin/sh
for x in $(cat team1.txt)
do
print "$x \c"
done
#end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:46 PM
09-01-2005 07:46 PM
Re: Text Manipulation .
awk '{printf $0" ";}END {print}' team1.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:56 PM
09-01-2005 07:56 PM
Re: Text Manipulation .
i) Your command rather shell script , works fine , But I dont understand why 2 print given in the script.
ii) Muthukumars perl script works great.
ii) also now Muthukumars awk command also now works fine , after putting printf .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 07:58 PM
09-01-2005 07:58 PM
Re: Text Manipulation .
awk '{printf $0" ";}END {print}' team1.txt > temp.txt
mv temp.txt team1.txt
AND,
Your profile says as,
I have assigned points to 126 of 211 responses to my questions.
Try to change to 211 of 211 responses by assigning points ;) It will give more responses and help.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 08:10 PM
09-01-2005 08:10 PM
Re: Text Manipulation .
$ tr -s '/\n' '/ /' < team1.txt > team2.txt
$ mv team2.txt team1.txt
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 08:16 PM
09-01-2005 08:16 PM
Re: Text Manipulation .
All above works ,
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 08:46 PM
09-01-2005 08:46 PM
Re: Text Manipulation .
Muthukumar , "Try to change to 211 of 211 responses by assigning points "
Can you have a look now ..
Thanks all & who replied. Got solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 08:47 PM
09-01-2005 08:47 PM
Re: Text Manipulation .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 08:48 PM
09-01-2005 08:48 PM
Re: Text Manipulation .
Thanks for turning into a user who has given more points than the responses. ;)
It is changed as,
======================================
I have assigned points to 216 of 213 responses to my questions.
======================================
:) Don't know. It is being a problem to some of the users. Post it in the ITRC Forums Issues.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2005 08:51 PM
09-01-2005 08:51 PM
Re: Text Manipulation .
------------