Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    16

    Red face Unanswered: How to cut a line in a text file?

    My requirement is to process each line in a text file (raw data). I believe I need to cut each line starting from the first line and follow by the next line until end of file. Each line cut will be appended to a temp file for manupulation before combining them eventually into a text file. Would appreciate for your help. Thanks.

  2. #2
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525

    Re: How to cut a line in a text file?

    Originally posted by tanboonhoe
    My requirement is to process each line in a text file (raw data). I believe I need to cut each line starting from the first line and follow by the next line until end of file. Each line cut will be appended to a temp file for manupulation before combining them eventually into a text file. Would appreciate for your help. Thanks.
    Sounds a bit crazy to me. What's wrong with awk or sed for the job? Can you elaborate on your requirements?
    Last edited by Damian Ibbotson; 02-09-04 at 13:55.

  3. #3
    Join Date
    Feb 2004
    Posts
    16

    Re: How to cut a line in a text file?

    Originally posted by Damian Ibbotson
    Sounds a bit crazy to me. What's wrong with awk or sed for the job? Can you elaborate on your requirements?
    I just want to cut each line in a text file starting from the first line until end of the file so that I can process the content in the record separately. I need to know as well how to move the pointer to the next line until end of file. FYI, I'm new in Shell scripts and awk and sed may be new to me.

  4. #4
    Join Date
    Jan 2004
    Location
    Bordeaux, France
    Posts
    320
    With shell you can do :
    Code:
    while read record
    do
        echo $record
    done < input_file
    With awk :
    Code:
    awk '{ print tolower($0) }' input_file
    Read post How to split one single text in multiple files?
    Jean-Pierre.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •