I'm having difficulties setting up a complex script with nested if statements while doing some word extracts, any help is appreciated.
Scenario:
1- Check if the file.txt has the word BINGO
2- If so then get the available number (any number) in the line that contains the word "TARGET" into number.txt
3- Check if number within number.txt is bigger than number in file basenumber.txt
4- If so, echo "Your BINGO number is bigger!"
5- If not, delete all files.
file.txt = "Header BINGO
You will check and take action ASAP.
Please go and compute the ticket 0550010 as it is the target.
grep, like all shell utilities, returns a code if it succeeds or fails. You don't need to count the number of lines it prints to tell whether it found anything. You can feed it directly into an if-statement and use less processes for the same result.
Here are the files that you need. My name is Brian.
You should know that so you can add my name to
your assignment when you turn it in.
Thanks Brian from Pittsburgh AKA gandolf989.
This is actually part of a solution for daily manual intervention that I face. It will surely help me a great deal. I'll make sure to put your nick and domain as author as well! (nobody will start contacting you so your fine LOL)
I'm still trying to understand all the variable that you set up, however I can thank you already.
The return code mapping 2 was helpful. OK got that.
export BASE_FILE=$1 export DUMP_FILE=$2 export BASE_NUMBER=`head -1 ${BASE_FILE}`I still couldn't understand how these variables run into place.
Maybe its the parameter I run within the command?
"/path/bingo.sh base.txt dump.txt"
Cool, got that.
Would the number extract parameter work only if its present in column 2, being separated by space? If not, its no big deal, I can arrange the correct column as dump file will always be with the same columns.
Hi All,
I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl:
run_build_model sparc_ifu_dec
run_drc
set_faults -model path_delay -atpg_effectiveness -fault_coverage
add_delay_paths P1
set_atpg -abort_limit 1000
run_atpg -ndetects 1000
I would like... (6 Replies)
Hello all,
I am currently trying to find the delta time from some GPS log.
I am using the following script with awk. But the script result shows some incorrect values (delta time some time = 0.2 but when I check it manually it is equal to 0.1)
My final goal is to get a script that print... (7 Replies)
Hi,
Need to extract only words not numbers
#cat test.txt
123456
oracle
web
56789
s21adm
Required output
#grep <options> test.txt
oracle
web
s21adm
Note, in between integer "s21adm" is required but not with full integer "123456" and "56789" (6 Replies)
Hello again everyone,
yes, I'm back again for more help! So I'm attempting to read two separate files and generate some XML code from that. My current code is:
BEGIN {
print "<?xml version=\"1.0\" encoding=\"utf-8\">"
print "<Export>"
}
{
x=1;
print "<section name=\"Query" NR "\">"... (5 Replies)
Hi , Need to shell script to extracts files names and write those to another file in different directory.
input file is
inputfile.txt
abc|1|bcd.dat
123 david123
123 rudy2345
124 tinku5634
abc|1|def.dat
123 jevid123
123 qwer2345
124 ghjlk5634
abc|1|pqr.txt
123 vbjnnjh435
123 jggdy876... (9 Replies)
I cannot get the code below to work correctly. The IF statement works just fine, but not the looping. The inner loop tries to find files for a given vendor; if found, I need to sleep giving another process time to move the files. Once the given vendor's files are gone, then I want to move on to the... (1 Reply)
Hello all,
I am writing up an input file and I was hoping I could get some guidance as to how to best consolidate these 2 awk statements for 1 while loop.
Here's my input file
# cat databases.lst
#NOTE: These entries are delimited by tabs "\t"
#oracleSID name/pass
#
db11 ... (2 Replies)
Hello,
I'm a shell scripting noob and new to this forum as well. My question is can nested if statements be done with && and || instead and if it can be done can someone provide an example pls.
Thanks in advance for the help (1 Reply)
Hi,
I know there is a way to have a script that include files in a way that once we run the script, it would extract those files. Kinda similar to how zip files work.
For example:
- I have a script called test.sh
- Once I run this script, it will extract file1, file2 and file3 and then... (2 Replies)