Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
shell script help
Name: esu (by Raj) Date: November 28, 2007 at 16:44:12 Pacific OS: Linux CPU/Ram: AMD Dual Core 2.4gz Product: x86_64
Comment:
Hello Linux users,
can someone help writing script for follwing issue. I have one text file(abc.txt) which get updated when some third party program finish running. When external(third party) program doesn't successfully finish, the text file updated with additional line : [munit] Test abc.tests.TestSuite FAILED
When external program finish execution successfully then text file doesn't include above line
I want to create shell script which check text file(abc.txt) to see if it contains above failure line, if it contains failure line then create another text file(xyz.txt) with just "FAILED" word in it. If text file(abc.txt) doesn't conat above failure line then abc.txt should contain only "PASSED"
Name: lankrypt0 Date: November 30, 2007 at 08:06:00 Pacific
Reply:
This should work fine. I was not sure if on PASSED you wanted it to go to xyz.txt or abc.txt so I assumed xyz.txt as that is where the failed status went to.
#!/usr/bin/ksh case $(grep '\[munit\] Test abc.tests.TestSuite FAILED' < abc.txt) in *[a-z]*) print "FAILED" > xyz.txt ;; *) print "PASSED" > xyz.txt ;; esac
0
Response Number 2
Name: esu (by Raj) Date: November 30, 2007 at 15:22:39 Pacific
Summary: Hi, can anyone help me, I am doing an assignment and I'm having trouble figuring it out. First of all. I am using the Bourne shell and I need to display the user of the shell script their Surname foll...
Summary: I need help on writing 2 shell scripts: 1) Write a shell script, to be called `keep', that will take any number of file names as arguments. It should remove all files from the current directory...
Summary: Please help me on two shell scripts: 1. the script simulates the ls -l command but prints only three columns of our choice. 2. the script makes a file out of the information in the etc/passwd. file u...