The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 06-20-2008
apsprabhu apsprabhu is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 43
Hi,
Try the below script. Customize, if required


for line in `cat test1.lst|cut -c1-16`
do
grep -i $line test2.lst >/dev/null
exitcode=$?
if [ $exitcode = 0 ]; then
echo "$line : String Exists"
else
echo "String does not exists, hence appending in test2 file"
echo $line >> test2.lst
fi
done