I faced this problem when I had to copy one file to another, but change or skip some lines. It's mandatory that all spaces of the copied lines were left unchanged. First of all I've tried this script:
{some analysis of str variable}
But it cut all leading and trailing spaces in the new line (it's a feature of "read" tool). Fortunately, it provides $REPLY variable if run without arguments. In this case $REPLY contains the line as is, with all spaces. So the working code was:
{some analysis of str variable}
A bit about
Hello, everyone! All you can see below is just my bank of information. Some material I've found in the fathomless net, some I've learned myself. Don't think all of the information here is right or actual, but may be it could be of use for you :) All feedback is welcome, especially constructive ones :)
Thursday, March 26, 2009
Shell: Reading a file line-by-line as is
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment