Hi all,

I found the following sed one-liner trick that strips out the spaces that I run
as follows:

sed 's/^[ \t]*//;s/[ \t]*$//' /tmp/file.txt > /tmp/filea.txt

This strips out the spaces in file.txt and cuts down its size from 600M+ to a
mere 60M. How do I apply this sed one-liner trick inside Perl in the most
easisest way? At the moment am running it via system "sed 's/^[ \t]*//;s/[
\t]*$//' /tmp/file.txt > /tmp/filea.txt"? Am sure you should be able to do this
without using system, can someone suggest how? Thanks in adbvance.

#sed one-liner tricks:
#   http://sed.sourceforge.net/sed1line.txt
#   http://www.pement.org/sed/sed1line.txt

#delete leading whitespace (spaces, tabs) from front of each line, aligns all
text flush left

 sed 's/^[ \t]*//'

#
# delete trailing whitespace (spaces, tabs) from end of each line

 sed 's/[ \t]*$//'

#
# delete BOTH leading and trailing whitespace from each line

 sed 's/^[ \t]*//;s/[ \t]*$//'




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to