10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyone!
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... (8 Replies)
Discussion started by: demmel
8 Replies
2. Shell Programming and Scripting
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)
Discussion started by: Parrakarry
5 Replies
3. Shell Programming and Scripting
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)
Discussion started by: dgreene
1 Replies
4. Shell Programming and Scripting
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)
Discussion started by: zomgshellscript
1 Replies
5. Shell Programming and Scripting
Hi guys,
I confused about syntax used in OR script as follow:
I have this sample file separated by "|" containing:
January|Month No. 1
February|Month No. 2
March|Month No. 3
April|Month No. 4
May|Month No. 5
June|Month No. 6
July|Month No. 7
August|Month No. 8
September|Month No. 9... (11 Replies)
Discussion started by: cgkmal
11 Replies
6. Shell Programming and Scripting
Hi
I use awk command to delete the first blanc line of a file:
awk '/^$/ && !f{f=1;next}1' infile > outfile
can somebody please explain me what the last "1'" in !f{f=1;next}1' stands for... Thansk a lot -A (3 Replies)
Discussion started by: aoussenko
3 Replies
7. UNIX for Dummies Questions & Answers
Hi,
Have to check file names in some given directory.
SO, What is the right syntax here:
*$3*=="'$object_list'" - just wanted to check if $3 is in the object_list.
And also, Do I need so many quotes around? (5 Replies)
Discussion started by: Leo_NN
5 Replies
8. UNIX for Dummies Questions & Answers
if ]; then
if ]; then
rm -f ${LOGFILE}.old
fi
mv ${LOGFILE} ${LOGFILE}.old
fi
Havent done nested ifs in a while. I'm reading someones code If I'm reading this correctly. It checks for the logfile, and if it exists it checks for the old logfile and if that exists, it removes the... (8 Replies)
Discussion started by: NycUnxer
8 Replies
9. Shell Programming and Scripting
I am trying to print the remaing fields and field numbers beginning with a field 'xyz'
#cat abc
test1:test2:xyz:test3:test4:test5
#cat def
test1:test2:test3:xyz:test4:test5
desired output is to be able to print NF and any trailing fields separated by':'
test3 3
or
test4 3
or
test5... (4 Replies)
Discussion started by: prkfriryce
4 Replies
10. Shell Programming and Scripting
Hi there could someone explain what is happening in the following function/statement for me, im just a little confused
code = 'BEGIN{FS=","}
{
printf ("%-11s,%s%s%s,%07.2f,%14s,%-3s\n",$1,substr($2,9,2),substr($2,6,2),substr($
2,3,2),$9,$10,$12)
}
this function is called later in the... (2 Replies)
Discussion started by: hcclnoodles
2 Replies