Find the answer to your Linux question:
Results 1 to 4 of 4
Hello! Basically the idea is to create a crispy script that adds break lines to every excel table in a file and saves them to different directory. I belive the ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    2

    Shell Script Command Subtitution

    Hello!

    Basically the idea is to create a crispy script that adds break lines to every excel table in a file and saves them to different directory.

    I belive the command <sed> is used but i don't know how and where to begin with that.

    Thank you for your big help!

  2. #2
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    1. You may explain more clearly and provide sample data file, don't really understand what you want to do.

    2. [How did you manage to come to the idea of 'command substitution' if you don't know at all how to tackle the problem ? What could ever be substituted ?]
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    2
    We would like to use this script on html which adds breaks and saves the file to another directory.

    Currently in the txt file we attached there is breaks and ,(comma) in certain format

    For example <tr><td> is break
    </td><td> is , (comma)
    </td></tr> is another break

    <tr><td>first</td><td>second</td></tr><tr><td>third etc.

    We like to use substitution command so that it will look like this

    (break)
    first, second
    (break)
    (break)
    third, fourth etc.

    Hopefully you can understand. Please ask if something is unclear

  4. #4
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    Code:
    cp /tmp/datafile /tmp/datafile.bak
    sed -i 's/<tr><td>/\n/g' /tmp/datafile
    sed -i 's/<\/td><\/tr>/\n/g' /tmp/datafile
    sed -i 's/<\/td><td>/,/g' /tmp/datafile
    It's about global string substitution using sed.

    It doesn't remove any other HTML tags.
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

Posting Permissions

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