- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sed syntax to insert carrage returns in middle of ...
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
12-02-2002 11:52 AM
12-02-2002 11:52 AM
I would like to run this through sed to either replace the '^L' with a carrage return with the rest of the original line starting on a new line or add a carrage return in front of the cntrl-L.
Can any one suggest a pattern to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 12:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 12:23 PM
12-02-2002 12:23 PM
Re: sed syntax to insert carrage returns in middle of a line
cat your_file_name | tr "\014" "\012"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 12:32 PM
12-02-2002 12:32 PM
Re: sed syntax to insert carrage returns in middle of a line
You sir should collect all your postings and publish them as a reference book for the rest of us!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 12:45 PM
12-02-2002 12:45 PM
Re: sed syntax to insert carrage returns in middle of a line
the line (sed 's/^L/^M^L/g') puts the characters "^M^" in front of any line beginning with a 'L' it does not deal with the control characters. It appears that the first ^ in the sed expression is interpreted as the anchor for a first character not as an cntrl-L character.
Tom's works but as it turns out I need to preserve the cntrl-L and add a cntrl-M before it.
Any more suggestions for sed ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 12:53 PM
12-02-2002 12:53 PM
Re: sed syntax to insert carrage returns in middle of a line
Here are a whole host of sed goodies
HTH
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 01:13 PM
12-02-2002 01:13 PM
Re: sed syntax to insert carrage returns in middle of a line
sed 's/^L/\^M^L/g'
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 01:16 PM
12-02-2002 01:16 PM
Re: sed syntax to insert carrage returns in middle of a line
If I could cause any text after a cntrl-L and including the cntrl-L to be put on a new line that would solve my problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2002 01:37 PM
12-02-2002 01:37 PM
Re: sed syntax to insert carrage returns in middle of a line
See if this works for you (by example):
# echo "line^Lenil"|sed 's/\^L/\^J\^L/'g
NOTE that the caret (^) is produced by holding CTRL-v and typing the character seen following it.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2002 06:12 AM
12-03-2002 06:12 AM
Re: sed syntax to insert carrage returns in middle of a line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2002 07:17 AM
12-03-2002 07:17 AM
Re: sed syntax to insert carrage returns in middle of a line
but a newline IS a control character:
NEWLINE = Ctrl-J
CARRIAGE RETURN = Ctrl-M
FORM FEED (New Page) = Ctrl-L
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2002 07:56 AM
12-03-2002 07:56 AM
Re: sed syntax to insert carrage returns in middle of a line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2002 08:01 AM
12-03-2002 08:01 AM
Re: sed syntax to insert carrage returns in middle of a line
This is what I see:
# echo 'abc^Ldef' > /tmp/ff
# od -c /tmp/ff
0000000 a b c \f d e f \n
0000010
# cat /tmp/ff
abc
def (you may not see this but def is indented)
# sed 's/^L/^M^L/'g /tmp/ff
abc
def
# sed 's/^L/^M^L/'g /tmp/ff | od -c
0000000 a b c \r \f d e f \n
0000011
I only "see" the control characters if I forget to Ctrl-V first.
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2002 08:05 AM
12-03-2002 08:05 AM
Re: sed syntax to insert carrage returns in middle of a line
Then RETYPE this. Don't cut-and-paste. Rather, type CTRL-v following by the letter you see in lieu of the caret (^):
# echo "line^Lenil"|sed 's/\^L/\^J/'g
line
The sed expression will substitute a NEWLINE for a FORMFEED globally throughout the stream.
I think part of the confusion is in what constitutes a "newline" in Unix. Unix doesn't need a carriage-return with a linefeed like Microsoft.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2002 09:17 AM
12-03-2002 09:17 AM
Re: sed syntax to insert carrage returns in middle of a line
cat
Thanks for all the help.... That Cntrl-V is a new one on me ....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2002 09:38 AM
12-03-2002 09:38 AM
Re: sed syntax to insert carrage returns in middle of a line
Glad you have found what you needed. Robin's use of 'xd' is a valuable tool and worthy of noting.
BTW, don't waste a process with:
# cat
Instead do:
# sed ...
Regards! :-)
...JRF...