Results 1 to 3 of 3
I have a script which parses for differences in directories listed in a file using egrep and awk I can pick out missing directories but now want to pass this ...
- 03-30-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
passing data between scripts
I have a script which parses for differences in directories listed in a file using egrep and awk I can pick out missing directories but now want to pass this to a mkdir command using some form of redirection i.e. the find / egrep gets me back the paths that are missing, how do I pass individual entries to mkdir simply?
- 03-30-2009 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
Use xargs. For example:
The missing directories will be appended to the end of the mkdir command.Code:find <whatever> | egrep <whatever> | xargs mkdir -p
- 03-31-2009 #3Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
As Iomcevak has said xargs is what your after.
If your script to find the missing paths outputs is complex, you might find it easier to pipe that into xargs i.e.
Code:<your script> | xargs mkdir -p
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.


Reply With Quote