How to launch results of a pipe?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to launch results of a pipe?
# 1  
Old 04-24-2012
Question How to launch results of a pipe?

Good afternoon,
I have just messed up and deleted some directories on my UNIX machine.
I would now want to know which packages are impacted by this. Therefore I have a look in the file "/var/sadm/install/contents" (which contains the filenames/directory names for each installation package). After this, I add "ls " in front and "1>/dev/null" at the back, so I get following result:

Code:
$grep "<Package>" /var/sadm/install/contents | awk {'print "ls " $1 " 1>/dev/null"'}
...
ls /usr/3rdpty/ant/lib/ant.jar 1>/dev/null
ls /usr/3rdpty/ant/lib/xercesImpl.jar 1>/dev/null
ls /usr/3rdpty/ant/lib/xml-apis.jar 1>/dev/null
Now I would like to launch those "ls" commands. The idea is the following:
$ls <existing file> 1>/dev/null
$ls <non-existing file> 1>/dev/null
<non-existing file>: No such file or directory

=> I intend only to see which files/directories have been erased that belong to the package. When there are none, nothing needs to be done. When there are some, the package needs to be re-installed.

In order to do this, I need to launch the "ls ..." output.
I have already tried using a "| eval" behind it, but this does not work.
Does anybody have an idea?

Thanks
Dominique

Last edited by Scott; 04-24-2012 at 09:19 AM.. Reason: Code tags
# 2  
Old 04-24-2012
If this is Solaris, then you can use pkgchk <Package> to check which files are missing.
# 3  
Old 04-24-2012
Thanks a lot, this is indeed far more easy Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

2. UNIX for Dummies Questions & Answers

Pipe binary file matches grep results to file

I am using grep to match a pattern, but the output is strange. $ grep -r -o "pattern" * Gives me: Binary file foo1 matches Binary file foo2 matches Binary file foo3 matches To find the lines before/after, I then have to use the following on each file: $ strings foo1 | grep -A1 -B1... (0 Replies)
Discussion started by: chipperuga
0 Replies

3. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

4. Shell Programming and Scripting

sed returns different results while substitution on a pipe delimited file

Hi, Need help with a sed command that I am using to substitute 3 positions of a pipe delimited file. i am getting different results while substituting the same position of two different files with the same value. Please see details below: $ cat chk2 ... (3 Replies)
Discussion started by: vmenon
3 Replies

5. Shell Programming and Scripting

Display find results, and pipe to xargs

I have an overnight script which runs across a large directory to repair permissions and ownership. I also have this command output the list of files affected so that cron can email these as a log file. Previously I had the command in the form: find /path/to/files -not -user myname -print -exec... (4 Replies)
Discussion started by: mij
4 Replies

6. Shell Programming and Scripting

Replace pipe with Broken Pipe

Hi All , Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix (1 Reply)
Discussion started by: saj
1 Replies

7. Shell Programming and Scripting

How can I execute the results of a pipe?

Hello, I'm using csh. I have a file named "setup" that I normally source, e.g. source setupI'd like a one-liner that sources this file, but excluding lines that contain "DEBUG", e.g. cat setup | grep -v DEBUG | sourceOf course, the above does not work. How can I execute the results of a... (5 Replies)
Discussion started by: acheong87
5 Replies

8. UNIX for Dummies Questions & Answers

Pipe results of Grep Command to LS Comand

I'm using the command grep -l XYZ to get a list of files containing the string XYZ. Then I using the comand ls -l ABC to get the create date timestamp of the each file. I've tried combining the comands using the pipe command, grep -l XYZ | ls -l, but its not working. What am I doing wrong? (3 Replies)
Discussion started by: jhtate
3 Replies

9. UNIX for Dummies Questions & Answers

Filter results through pipe with grep

ls -ltr | grep string How can I use regular expressions to filter the results provided even more. I am using the above command as a reference. (1 Reply)
Discussion started by: ckandreou
1 Replies

10. UNIX for Dummies Questions & Answers

Pipe SQL select statement results to script

Hello I would like to perform a select from a oracle table and return those values to my shell script For example: site=head -1 $infile | cut -c1-15 | awk '{printf "s%", $0} sqlplus -s /nolog |& #Open pipe to sql select col1, col2, col3, col4 from oracle_table where col5 =... (6 Replies)
Discussion started by: houtakker
6 Replies
Login or Register to Ask a Question