09-05-2007
How do i iterate thru each line of a file in shell scripting?
Hi All,
I need to execute some commands on each line of a file.
How do i iterate thru each line of a file?
In detail:
First i will have to go to the first line of the file and execute a series of commands on it and then take the second line of the file, execute a series of steps and so on. I need to repeat this process until the last line of the file.
Please help me.
Thanks in anticipation,
Ravi.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a problem in my HP Unix system , it is briefly :
I have two files : Myfile and Script.sh :
Myfile contain this lines :
String1 string2 string3 string5
String1 string2 string3 string5
String1 string2 string3 string5 ... (2 Replies)
Discussion started by: KSA
2 Replies
2. Shell Programming and Scripting
I have a file containing records seperated by delimiter '|'.A record is contained on 2 or 3 lines. Now I need a shell script which could write all records with in two '|' character in one line.....for example.....
|R1........................R1
R1..........................R1... (2 Replies)
Discussion started by: 33junaid
2 Replies
3. Shell Programming and Scripting
I have a line of more than 3000 bytes which will contain & as fields separator..I am using following awk command ..Its working but its not accepting the line more than 3000 bytes...Anyother alternate solution even in othe shell command also fine...
awk -F '&' '{for( i=1; i<=NF; i++ ) print $i}'... (2 Replies)
Discussion started by: punithavel
2 Replies
4. Shell Programming and Scripting
Hi all,
I am new to awk programs.I have a file like this
1234567@2345||adcbdefhij: asgdfdasdfhhfd-asdfasd-dsfasdf |0.678|0.0|0.213
1234567@2345||adcbdefhij: ashhfd-asdfasd-dsfasdf |0.129|0.0|0.411
1234567@2345||adcbdefhij: asd-aasd-dasdf |0.223|0.0|0.276
I want to delete the text which... (3 Replies)
Discussion started by: Loy81
3 Replies
5. Shell Programming and Scripting
Hi All ,
I am new to shell scripting.
i have a shell script(which is executed as a super user) , i want to it to do one more job for me. ie mounting a directory over other using lofs .
i have done it manually using
1) using mount command
mount -F lofs /export/home/dju /dju
2)... (4 Replies)
Discussion started by: meet123321
4 Replies
6. Shell Programming and Scripting
Hi,
I have a directory call Test, which contains files "a", b", "c", etc. I want to go through all of the files inside Test and remove any empty file. How would I do that with shell csh?
So far I got...
#!/bin/csh
if (($#argv == 0) || ($#argv > 1)) then
echo "no argument or too... (2 Replies)
Discussion started by: teiji
2 Replies
7. Shell Programming and Scripting
Hi,
I need to check if a parameter provided at the command line is equal to --.How can i do that ? Please help me.
Thanks and Regards,
Padmini (4 Replies)
Discussion started by: padmisri
4 Replies
8. Shell Programming and Scripting
Hi Experts,
I need one line script for the below requirement.
First it should check if a directory with todays date exist, and if not create it and move the PDF file to that directory.
thanks in advance!!! (2 Replies)
Discussion started by: eeegopikannan
2 Replies
9. UNIX for Dummies Questions & Answers
Hi guys,
I am having trouble with this script. What i want it to do is to iterate all command line arguments in reverse order. The code below does this fine but i need the output to print the words on separate lines instead of one line:
#!/bin/bash
#Takes in the arguments and displays them... (7 Replies)
Discussion started by: pipeline2012
7 Replies
10. Shell Programming and Scripting
Take example of below file.
abc.txt
nas1:/abc/test/test1 /test
nas1:/abc/test/test1/test2 /test/abc
nas1:/abc/test/
Now i have a variable that contains "nas1:/abc/test/test1" value , so i need to search the above file for this variable and print only this line.
... (14 Replies)
Discussion started by: mohit_vardhani
14 Replies
LEARN ABOUT SUNOS
multimode
asadmin-multimode(1AS) asadmin-multimode(1AS)
NAME
asadmin-multimode, multimode - allows you to execute multiple commands while preserving environment settings and remaining in the asadmin
utility
SYNOPSIS
multimode [--file filename] [--printprompt=true] [--encoding encode] [--terse=false] [--echo=false]
Use multimode to process the asadmin commands. The command-line interface will prompt you for a command, execute that command, display the
results of the command, and then prompt you for the next command. Additionally, all the asadmin option names set in this mode are used for
all the subsequent commands. You can set your environment and run commands until you exit multimode by typing "exit" or "quit." You can
also provide commands by passing a previously prepared list of commands from a file or standard input (pipe). You can invoke multimode from
within a multimode session; once you exit the second multimode environment, you return to your original multimode environment.
This command is supported in local mode only.
--file reads the commands as defined in the file.
--printprompt allows the printing of asadmin prompt after each command is executed. Set this option to false when the commands
are piped or redirected from the standard input or file. By default the option is set to true.
--encoding specifies the locale for the file to be decoded.
--terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well-
formatted data for consumption by a script. Default is false.
--echo setting to true will echo the command line statement on to the standard output. Default is false.
Example 1: Using multimode to execute multiple commands
example% asadmin multimode --file commands_file.txt
Where: example% is the system prompt. The multimode settings are executed from the commands_file.txt file.
EXIT STATUS
0 command executed successfully
1 error in executing the command
asadmin-export(1AS), asadmin-unset(1AS)
J2EE 1.4 SDK March 2004 asadmin-multimode(1AS)