Search Results

Search: Posts Made By: santonio
3,415
Posted By Scrutinizer
sed "/$Title/d" BookDB.txt > BookDB1.txt && mv...
sed "/$Title/d" BookDB.txt > BookDB1.txt && mv BookDB1.txt BookDB.txt
If you have GNU sed you can do an in place edit:
sed -i.bak "/$Title: $Author/d" BookDB.txt
1,684
Posted By dsw
You could test the return code from the grep ...
You could test the return code from the grep

name="john"
age=25
file=txt
grep -x ${name}:${age} $file 2>&1 > /dev/null

if [ "$?" -eq "0" ]; then
echo "User exists"
fi

...
Showing results 1 to 2 of 2

 
All times are GMT -4. The time now is 08:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy