#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Unable to unpack with bunzip2 using while loop


    Hello Team,

    I have a problem with unzipping some file.xml.bz2 files to file.xml in while loop.

    all other processing on files is successfull except bunzip2.

    here is my piece of code

    while read i
    do
    bunzip2 $i
    done<file.lst;


    output

    : No such file or directory.le file1.XML.ftpfail.bz2
    : No such file or directory.le file2XML.ftpfail.bz2
    : No such file or directory.le file3.XML.ftpfail.bz2
    : No such file or directory.le file4.XML.ftpfail.bz2

    file.lst contains the names of the file names.

    " i " is detecting the file name correctly..

    when i use bunzip2 filename as a single command it is working.. but in loop it is failing to detect the file and showing the error as above.

    kindly suggest me with the what is the issue.

    thank a lot in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,481
    Rep Power
    1752
    The names of the files in the error message look a little 'strange' to me. Also the second file in the list of errors has no '.' before the XML part - not that that matters, so long as the name is correct!
    If the use of bunzip2 in that loop is not working then, strictly, you will have an issue with the file name - are you sure there are no control characters in the file?
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    859
    Rep Power
    388

    Cool


    Originally Posted by maroom
    Hello Team,

    I have a problem with unzipping some file.xml.bz2 files to file.xml in while loop.

    all other processing on files is successfull except bunzip2.

    . . . E t c . . .
    kindly suggest me with the what is the issue.
    As Simon says...It seems to be the file name.

    Use the ls command with -b or -q options to determine is there are non-printable characters in the file name.

    PS: Post the contents of the "file.lst" file.

IMN logo majestic logo threadwatch logo seochat tools logo