- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Breaking up is hard to do
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
11-28-2000 08:57 AM
11-28-2000 08:57 AM
instead of:
Can anyone help? Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2000 09:02 AM
11-28-2000 09:02 AM
Re: Breaking up is hard to do
You may also want to look at the tr command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2000 09:11 AM
11-28-2000 09:11 AM
Re: Breaking up is hard to do
Use tr. Eg, input file (called tt) looks like;
aaa>bbb>ccc>
tr "[>]" "[\012]" < tt
gives output;
aaa
bbb
ccc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2000 09:30 AM
11-28-2000 09:30 AM
Re: Breaking up is hard to do
That gets me a lot closer, but I need to retain the '>' character. For example, aaa>bbbb>ccc> needs to be turned into:
aaa>
bbbb>
ccc>
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2000 01:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2000 08:25 PM
11-28-2000 08:25 PM
Re: Breaking up is hard to do
...Yet another way to do it. Enter this exactly as shown below, that is, span the command over two lines.
sed 's/>/
/g' file
Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2000 12:04 AM
11-29-2000 12:04 AM
Re: Breaking up is hard to do
sed 's/>/>\\^J/g' file
don't how the backslashes,etc will come out,
but that is a backslash cnt-J
this will probably leave you with a blank line at the end
of your output. if you want that removed:
| sed '/^$/d' to delete empty lines.
another way is:
cat file | awk -F\> '{ for ( i=1;i<=NF;i++) print $i ">";}'
you'll end up with a blank line with that method also.
both sed and awk are line based utilities, meaning if your lines are longer then a few thousand characters
they will give you a "line too long" error.
in which case you probably have to use "tr" to break up you line into small segments then add the > back to the end of the lines
cat file | tr ">" "\012" | sed -e 's/\(.*\)/\1>/' -e '/^$/d'