Find the answer to your Linux question:
Results 1 to 1 of 1
Nevermind/sorry, that was the output of some other sed command along the script, this command actually works! Not really important, but I'm just curious. We often see things like "echo ...
  1. #1
    Linux Newbie
    Join Date
    Apr 2007
    Posts
    211

    Smile [SOLVED] Non-crucial sed question: "grep'ing" and sed'ing with a single sed command?


    Nevermind/sorry, that was the output of some other sed command along the script, this command actually works!




    Not really important, but I'm just curious. We often see things like "echo * | grep * | sed" when just one or two would suffice, I'm just revisiting some old scripts and finding this sort of thing, and trying to "fix" them.


    I have a file list on a file (which happens to be stated as a variable), and one of those files in the list has a ">" preceding its path. I'm trying to use just sed to both grep that line, and strip just the file name. I'm almost there, I get the desired result, but there's an error message.

    This is the command:

    sed -n 's|>.*/||p' $filelistfile



    And the error message is:

    sed: -e expression #1, char 8: extra characters after command
    sed: -e expression #1, char 8: extra characters after command


    Twice, as it is.

    It has, however, the same output of a grep | sed combo, before these messages!
    Last edited by the dsc; 08-09-2010 at 07:20 PM. Reason: it was all a silly mistake

Posting Permissions

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