10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi there, new to this forum and I recently encounter this problem:
I tried to use if-elif loop in a while-read loop, something like this:
#!/bin/bash
while read myline1 myline2
do
if ; then
echo "Successful!"
elif ; then
echo "Failed"
fi
done < $1
Input file looks like this:
200... (13 Replies)
Discussion started by: kennethtls
13 Replies
2. Shell Programming and Scripting
Hey all,
Tried searching the forums but my search-fu may not be strong today; please feel free to redirect me if I have simply missed a post that would be helpful!
Trying to create a while loop that reads a list of configuration files, checks for a line that starts with "SOME_CMD" and ends... (4 Replies)
Discussion started by: jdwyer
4 Replies
3. UNIX for Dummies Questions & Answers
hi,
this is my script #!/bin/ksh
cat temp_file.dat | while read line
do
read test
if ]; then
break
else echo "ERROR"
fi
done
when i execute this code , the script does wait for the user input . it directly prints "ERROR" and terminates after the no. of times as there... (3 Replies)
Discussion started by: siva1612
3 Replies
4. Shell Programming and Scripting
Hi guys
what I wanna do is to create a script where can I input several times a file - assume with read function that will be inserted into a temp. file for further processing. When I press q I want that the loop will stop and continue in my script
I typed this but the options q is not working... (6 Replies)
Discussion started by: kl1ngac1k
6 Replies
5. Shell Programming and Scripting
Hi I'm writing a bash script which will read an input file and look for occurrences of the current user ($USER) executing the script. When i find the occurrence of the username I take that line and append it to a file with a line number and bracket display next to line.
The input file has been... (12 Replies)
Discussion started by: BundBash
12 Replies
6. Shell Programming and Scripting
Hello,
The code below pulls printer information from a three-column file (set by the ${MULTIFILE} variable at the end), that has the printer queue name, IP, and type of printer. It is supposed to use this info to add the printers in the list to one, or more servers . The input file... (3 Replies)
Discussion started by: LinuxRacr
3 Replies
7. Shell Programming and Scripting
hi all,
Can you please help me with this issue ?
while ####infinite loop
do
cat file1 |while read var1 var2
do
func1 $var1 $var2
done
cat file2 | while read var11 var22
do
func2 $var11 $var22
done
done
func1 is called till all the values are read... (2 Replies)
Discussion started by: Navatha
2 Replies
8. UNIX for Dummies Questions & Answers
count2=0
var2=NOT
if
then
echo"Loop1"
command="egrep ',$var1,"
if
then
echo "the command is OR"
command=$command"|,$var3,"
echo "$command"
elif
then
command=$command"| egrep ',$var3,"
else
... (4 Replies)
Discussion started by: Syms
4 Replies
9. UNIX for Advanced & Expert Users
Hi all
I have a while read loop that I use to process a file line by line. The reason I am using this is due the fact that I have spaces in the line and a for loop treats the space as a delimeter for the next record.
In this while loop I have a rsh. It appears that cos of the rsh, I never get... (1 Reply)
Discussion started by: 104234
1 Replies
10. Shell Programming and Scripting
I have a script which tries to read input from a user for every value read from a file. The input file is
#> more testfile
TEST1 | D200 | 12345601 | | ABC company | m
TEST2 | D201 | 12345602 | | ABC company | m
The script test.sh is as follows
while read line
do
read test?"Enter a... (5 Replies)
Discussion started by: jerardfjay
5 Replies