leading spaces in a text file.
Quoted 9 lines · Matthew Stapleton
At the beginning of each line there are leading spaces that i wish to get rid of.
Something like the following:
<leading spaces><line content>
<leading spaces><line content>
<leading spaces><line content>
<leading spaces><line content>
Oh. Every *line* is quite different from every *sentence*. Still, assuming the file uses Unix-style newlines, something about like
tr "\n " "\n"
should get rid of the last one after you've used whatever you already use to reduce the multiple spaces to one.
I say "about like" because the cli command tr has less flexible pattern specification than the Perl-command tr, so I may have the details wrong ... but the basic idea is about right.
--
-------------------------------------------"Never tell me the odds!"--------
Ray Olszewski -- Han Solo
Palo Alto, California, USA [email protected]
-------------------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
sed "s/^ *//" oldfilename > newfilename
Learn regular expressions. ;)
Quoted 11 lines · Matthew Stapleton
At the beginning of each line there are leading spaces that i wish to get rid of.
Something like the following:
<leading spaces><line content>
<leading spaces><line content>
<leading spaces><line content>
<leading spaces><line content>
Quoted 11 lines
Matthew Stapleton
====================================
http://webpages.marshall.edu/~staple12
Resistance is Futile!
====================================
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Bryan Whitehead
SysAdmin - JPL - Interferometry Systems and Technology
Phone: 818 354 2903
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
At the beginning of each line there are leading spaces that i wish to get rid of.
Something like the following:
<leading spaces><line content>
<leading spaces><line content>
<leading spaces><line content>
<leading spaces><line content>
Matthew Stapleton
====================================
http://webpages.marshall.edu/~staple12
Resistance is Futile!
====================================
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs