use of xargs command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers use of xargs command
# 1  
Old 10-29-2003
use of xargs command

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
This User Gave Thanks to kishorebabu For This Post:
# 2  
Old 10-30-2003
Is this for a homework assignment? Perhaps the manual pages will help.
# 3  
Old 10-30-2003
Its not a homework.

I am going through a tutorial and I have across this.

I tried the man pages, but couldn't really understand what it is talking about.
# 4  
Old 10-30-2003
what tutorial?
# 5  
Old 10-30-2003
The book I was talking about is Unix for Oracle DBAs
# 6  
Old 10-30-2003
Re: use of xargs command

it is very aparent if you do a test what the differance between those 2 commands are.

Code:
# ls -l ; cat one two three
total 6
-rw-r--r--   1 root     other          2 Oct 30 12:43 one
-rw-r--r--   1 root     other          2 Oct 30 12:43 three
-rw-r--r--   1 root     other          2 Oct 30 12:43 two
1
2
3
# find . -print|xargs grep 2
./two:2
# find . -print| grep 2
#

what do you notice about this example. i am sure it looks something along the same basis as in your book.

i could just come out and say what the differance is. but i dont think you will honestly learn and remember the differance. so i am trying to make you think about it.

Last edited by Optimus_P; 10-30-2003 at 03:03 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Xargs -P command execution status

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)
Discussion started by: ankur singh
1 Replies

2. Shell Programming and Scripting

Looking for XARGS command Silent options

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)
Discussion started by: nareshreddy443
2 Replies

3. Shell Programming and Scripting

Pipe output a command to another using xargs

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)
Discussion started by: mahesh113
1 Replies

4. Shell Programming and Scripting

need help with xargs command..

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)
Discussion started by: guptam
8 Replies

5. Shell Programming and Scripting

Doubt in xargs command

Hi, What is the difference in capitalizing the option 'i' of xargs command, (i.e) xargs -i and xargs -I? Also, what is the difference between the below 2 commands? output_from_cmd | xargs -I {} grep '{}' file output_from_cmd | xargs -I grep '{}' file Any efficiency or performance... (4 Replies)
Discussion started by: royalibrahim
4 Replies

6. Shell Programming and Scripting

xargs command

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)
Discussion started by: zam
11 Replies

7. Shell Programming and Scripting

xargs command problem

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)
Discussion started by: tiger66
1 Replies

8. UNIX for Dummies Questions & Answers

querry about xargs command

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)
Discussion started by: mobydick
1 Replies

9. AIX

command usage on find with xargs and tar

my task : tar up large bunch of files(about 10,000 files) in the current directories that created more than 30 days ago but it come with following error find ./ -ctime +30 | xargs tar rvf test1.tar tar: test1.tar: A file or directory in the path name does not exist. (3 Replies)
Discussion started by: darkrainbow
3 Replies

10. Shell Programming and Scripting

Xargs command outupt to file

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)
Discussion started by: byblos
3 Replies
Login or Register to Ask a Question