Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Unanswered: what are these options

    A question -

    find . -name '*.sh' | xargs perl -p -i'_save' -e 's+rick+brick+g'

    In this command, I know that it replaces all occurances of rick in the .sh files and changes it to brick. And also makes a copy in the _save file.

    Now what does xargs, perl , -p, -i and -e options indicate?


  2. #2
    Join Date
    Jan 2004
    Bordeaux, France
    man find
    man xargs
    man perl

    find . -name '*.sh'
    find all files named '*.sh' in the current directory and sub-sirectories, and print filenames to stdout

    xargs perl ...
    xargs reads filenames (arguments) from the standard input and executes the command 'perl' one or more times with any initial-arguments followed by arguments read from standard input.
    For example, if there are two file '' ans '', wargs build and executes the following command :
    perl perl -p -i'_save' -e 's+rick+brick+g'

    perl -p -i'_save' -e 's+rick+brick+g'
    Execute perl with the options :
    -p : causes Perl to proceed input files line by line, executing the program (-e '...') for each line
    -i'save_' : input files are saved with name *.sh_save, output files are named *.sh
    -e 's+rick+brick+g' : specify a line of program to execute. Substitutute all occurence of 'rick' by 'brick' in the input file(s).

  3. #3
    Join Date
    Feb 2004
    Thanks a lot

Posting Permissions

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