Profile cover photo
Profile photo
Josh Morgan
180 followers -
Ego maniac with an inferiority complex
Ego maniac with an inferiority complex

180 followers
About
Josh's interests
View all
Josh's posts

using this line in a script to find and replace a word in a file:

grep -lr "$oldWord" $somefile | xargs sed -i "s/$oldWord/$newWord/g" $somefile

I want to see if $oldWord exists in the file, but I think the line I am using is checking the exit status of sed instead of grep.

if [ $? -eq 1 ]
then
      echo "String doesn't exist in file"
fi

Any suggestions ?

Post has attachment
Taking a Introduction to Linux/Unix class for summer. Any thoughts on this text we will be using?
Photo

Post has attachment
Starting an Introduction to Linux/Unix class for summer. Any thoughts on this text?
Photo

Post has attachment

Post has attachment
What a #Ravens game today!
Animated Photo

Post has attachment
I won candy on the #googlebirthday doodle! Score: 145

Post has attachment

Post has attachment

Post has attachment
Wait while more posts are being loaded