-i[replace-str]
This option is a synonym for -Ireplace-str if replace-str is specified, and for -I{} otherwise. This option is deprecated; use -I in stead.
grep reads from a pipe/stdin so there should be no need for xargs in your case.
It means the following:
Using -i is old, depricated, ie. should be no longer used. Instead, you should use -I. The curled brackets {} is just the string, which should be replaced by the argument which is being handed over to xargs. So you can position it in the line's syntax. You could use other characters but the curled brackets instead. This placeholder is just being defined with -I, example:
In this case I just took a single underscore instead of opening and closing curled bracket. Curled brackets are just some kind of "standard" for this most people use because it is or might be easier to read. If there would be more than one usage of the argument in a command's syntax (for example let's say 2), you could use 2 times the _ or {} or whatever character(s) you defined with -I as placeholder in your following command supplied by xargs. Example:
In simple cases where you have just 1 argument being passed to xargs and it should be placed at the end your command, you don't even have to use -I as xargs just places it automatically at the end of the command:
Hi,
I am working on a file copier utility where I have written the copy commands to a batch file e.g. file_copier.bat which i pass to xargs command as follows.
cat file_copier.bat | xargs -n 1 -P 40
I also want to record the copy command status of each file/command in the form "command... (1 Reply)
ls | grep -E '^+$' | xargs --verbose -I{} rm -vfr "{}";
When i execute the command it works fine by removing the directories and its writing the output as below about which files are deleting.What i want know is,is there any XARGS command option that it should done silently in background with... (2 Replies)
xargs work great when a command gives multiple line output which can be input to another. In my case it is not working coz the second command uses two words in it.
$ scr.sh
gives output like
193740
638102
375449
..
..
another command takes these number as inputs. it works great... (1 Reply)
ls -lrt | awk '$7==12{print $9}' | xargs -i mv {} $dir
i executed this command but $dir does not exists.......
and the files hv been moved but i dont know where .....
plz help(ASAP)
thanks in advance. (8 Replies)
Hi
The command below does not work. what I am doing wrong ?
For some reason second part of the xargs command is not does what I expect
If I get this working I intend to use it for multiple file rename later.
echo archDP105144_1_702159963.dbf|xargs -i cp {} `echo {}|awk... (11 Replies)
Hi
I am trying to use "xargs" command to loop through each file, modify it and overwrite the old file with the modification but with the same file name.
I thought it is easy but I just can't get it to work
I tried the following
I thought {} would give me the current file name, but it... (1 Reply)
what is the real use of xargs command ..?
ls -tr |xargs -I{} rm -f {}
....can any one tell me what is the significance of {} curly brackets in this command (1 Reply)
Hello,
I'm on a mac trying to have the follow cmd list the files after touch, but very unsuccessful. Please can you help.
sort $BOTHFILE | uniq -u | xargs -I {} -t touch {} >> $LOGFILE ;
BOTHFile contents in form of
/directory/file.txt
thanx (3 Replies)
Hi
Is there any way to append constant string with arguments generated by xargs..
Like I want to delete some files .. where in I have to add directory also ...
ex : echo $fileName | xargs rm $Dir/ValuesFromls
Here I have to append Directory name with filename...
Shihab (1 Reply)
Hi Everybody,
Can you explain the difference between the following commands:
1. find . -print|xargs grep -i dba_2pc_pending
2. find . -print|grep -i dba_2pc_pending (5 Replies)