Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Posts
    2

    Unanswered: How to delete one line in a file in a loop

    Hi there,
    I am very new to UNIX,

    I have problem. I have file in the following format.
    20080101,1234
    20080102,2345
    20080103,3456
    20090101,1245
    20090102,1534
    ....
    ...

    As part ot automating a process, i am suppose to read the first line and process the first cycle(20080101). Upon completion, the first line has to be deleted and then the process should start with the second cycle(the first line after deletion, 20080102).

    Please, can some one help.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Wouldn't it be easier to delete the entire input file after you finish processing all lines?
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Jul 2009
    Posts
    2
    As i said, i am newbie in UNIX. Please suggest how i can do that.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    You would use the while command to organize a loop, the read command to read each line, and the rm command to delete the file when done.
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

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