![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Combination of find -xargs & wc -l | mr_bold | UNIX for Dummies Questions & Answers | 4 | 07-08-2008 06:07 AM |
| Problem using find and xargs | quixote | Shell Programming and Scripting | 5 | 05-02-2008 11:24 PM |
| command usage on find with xargs and tar | darkrainbow | AIX | 3 | 12-25-2007 06:25 PM |
| strange behavior of find with xargs | jerardfjay | Shell Programming and Scripting | 9 | 08-09-2007 09:06 AM |
| find | xargs cat | asal_email | Shell Programming and Scripting | 4 | 03-17-2005 12:16 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
find | xargs cat
Hi,
I am having trouble getting a combination of commands to work. I need to traverse through all sub-directories of a certain directory and 'cat' the contents of a particular file in the sub-directories. The commands on their own work but when I combine them I get no output. The command I am trying to get working is: find . -type f -name "developer.txt" | xargs cat The find command works correctly and when I copy and paste the output of that with a preceeding 'cat', the contents are printed out. However together with the pipe the commands are not working. |
|
||||
|
1) Your command seems for work for me under Linux and Solaris
2) The find command has its own execution capability (-exec). Thus you may want to try ... Code:
find . -type f -name "developer.txt" -exec cat {} \;
|
|
||||
|
That worked, but need filename output
Thanks for that Wabard.
That worked a treat for command. I'm trying to run this on SuSe Linux. I have just added another option to the find command so I know which file is being 'cat'ed. find . -type f -name "developer.txt" -ls -exec cat {} \; Cheers, Dave. |
|
||||
|
Quote:
Code:
find . -type f -name "*.c" -exec awk 'BEGIN{s="====================="} {if(n++<1){printf("%s %s %s\n",s,FILENAME,s)}else{print}}' {} \;
|
|
||||
|
for one, wouldn't either less or more (or even view) serve better than cat? I'm assuming it's more of an interactive session you're looking for...? While find does allow for its own -exec parameter, xargs is faster by a long-shot.
However, it reads as though your problem is more so with the terminal than the shell commands... Quote:
Code:
for item in $(find . -type f -name "developer.txt" ) ;do cat $item ;done |
![]() |
| Bookmarks |
| Tags |
| linux unix xargs cat find |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|