Unix/Linux Go Back    

Substitute newline with tab at designated field separator

Shell Programming and Scripting

Kindly Note - This is a Single User Post by Forum Member hanson44 Regarding:
Substitute newline with tab at designated field separator.
Please Follow The Primary Link Above to View the Full Discussion.

Old Unix and Linux 04-02-2013   -   Original Discussion by yifangt
hanson44's Unix or Linux Image
hanson44 hanson44 is offline
Registered User
Join Date: Mar 2013
Last Activity: 12 May 2013, 11:33 PM EDT
Posts: 858
Thanks: 18
Thanked 183 Times in 178 Posts
Be happy to. l (ell, not one) is a basic sed command that helps diagnose what is going on. l (ell) prints the pattern space in a special format, for debugging. l (ell) is never (or extremely rarely) used for production scripts.

So in the example, l (ell) is showing what the pattern space looks like immediately before running the s (substitute) command. It shows the embedded \n characters that N introduced at each step. It also shows a $ at the end of the line. There is not really a $ there. It is just part of the special display format of the l command, to mark the end of the pattern space.

I think the mnemonic for l is "line", or maybe "list". Not sure.

BTW, if pattern space if long, l (ell) will wrap at 70 characters, which is usually not desirable. You could use "l 0" to run the l command without word wrapping.
The Following User Says Thank You to hanson44 For This Useful Post:
yifangt (04-02-2013)