[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

string search

Posted on 2013-01-15
2
Medium Priority
?
313 Views
Last Modified: 2013-01-16
Whats wrong in this code? Accepted a different but realized it wont fit my req. This was one
solution but even though ids are missing I get a blank email

cut -c 1-3 all.out > trailer.txt
while read $ID; do
 if ! grep -q ^$ID trailer.txt; then
   echo $ID not found
 fi ; done < ids.txt | mail -s "Missing ID(s)" mail@domain.com
ids.txt
trailer.txt
0
Comment
Question by:uco
2 Comments
 
LVL 85

Accepted Solution

by:
ozo earned 2000 total points
ID: 38780514
try
while read ID; do
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 38780749
To find things out yourself (ozo's remark above is correct), try this next time:

sh -xv your_script.sh

this will run your script with verbose output so you'll be able to see what and where things go wrong.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question