01-19-2012
Reading a word from a text file into shell script
Hi,
I am new to shell programming.I need to write a script that would accept a word from each line fo an input text file.Can anyone help me with this?Exact requirement: word1 word2 word3 (separated by space) .Now I need word3 from each such line in the text file.
Thanks in Advance,
Manish
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
How can i dynamically read files names from a list file and execute them from a single shell script.
Please help its urgent
Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
2. Shell Programming and Scripting
Greetings.
I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file.
I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies
3. Shell Programming and Scripting
For reading a file through shell script I am using yhe code :
while read line
do
echo $line
done<data.txt
It reads all the line of that file data.txt.
Content of data.txt looks like:
code=y
sql=y
total no of sql files=4
a.sql
b.sql
c.sql
d.sql
cpp=n
c=y
total no of c files=1 (4 Replies)
Discussion started by: Dip
4 Replies
4. Shell Programming and Scripting
Hi,
Data file named parameter contains :
DB=y
Alter_def.sql
Create_abc.sql
SQL=y
database.sql
my_data.sql
To read this file I use
var_sql=$(awk -F= '$1 == "SQL" { print $2 }' parameter.txt)
if
then
sql_f_name=`grep "\.sql" parameter.txt`
echo $sql_f_name
fi (2 Replies)
Discussion started by: Dip
2 Replies
5. Shell Programming and Scripting
FOLKS ,
i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one.
thanks...
Venu (3 Replies)
Discussion started by: venu
3 Replies
6. Shell Programming and Scripting
Hi!
i need a script that can read a property file.
i.e., A script to read a "property" from property file.
Read the property value and
based on value of property, decide whether to start the some dataload activity or not.
Its urngent. Can anyone help me out???:( (7 Replies)
Discussion started by: sukhdip
7 Replies
7. Shell Programming and Scripting
Hello,
I have a text file which has list of SQL Commands, from where I have grepped the lines where there is a specific string:
grep <string> <file1> >> <file2>
A sample of the file2 is:
INSERT INTO PS_PWC_SP_ERN_DATA SELECT A.EMPLID ,B.COMPANY ,B.PAYGROUP ,
B.OTH_PAY FROM... (7 Replies)
Discussion started by: suddhasatwa_bha
7 Replies
8. Shell Programming and Scripting
Hello everybody,
My first time here and my english is not very good I hope you understand me.
I'm trying to read a file that contains two zip archive names.
Here my file content is:
package1.zip package2.zip
At the end of the line there is a \n character.
I read this file from a... (2 Replies)
Discussion started by: Aurea
2 Replies
9. UNIX for Dummies Questions & Answers
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies
CSREQ(1) BSD General Commands Manual CSREQ(1)
NAME
csreq -- Expert tool for manipulating Code Signing Requirement data
SYNOPSIS
csreq [-v] -r requirement-input -t
csreq [-v] -r requirement-input -b outputfile
DESCRIPTION
The csreq command manipulates Code Signing Requirement data. It reads one requirement from a file or command arguments, converts it into
internal form, checks it, and then optionally outputs it in a different form.
The options are as follows:
-b path
Requests that the requirement read be written in binary form to the path given.
-r requirement-input
Specifies the input requirement. See "specifying requirements" below. This is exactly the same format as is accepted by the -r and -R
options of the codesign(1) command.
-t Requests that the requirement read be written as text to standard output.
-v Increases the verbosity of output. Multiple instances of -v produce increasing levels of commentary output.
In the first synopsis form, csreq reads a Code Requirement and writes it to standard output as canonical source text. Note that with text
input, this actually compiles the requirement into internal form and then converts it back to text, giving you the system's view of the
requirement code.
In the second synopsis form, csreq reads a Code Requirement and writes its binary representation to a file. This is the same form produced by
the SecRequirementCopyData API, and is readily acceptable as input to Code Signing verification APIs. It can also be used as input to subse-
quent invocations of csreq by passing the filename to the -r option.
SPECIFYING REQUIREMENTS
The requirement argument (-r) can be given in various forms. A plain text argument is taken to be a path to a file containing the require-
ment. This program will accept both binary files containing properly compiled requirements code, and source files that are automatically com-
piled for use. An argument of "-" requests that the requirement(s) are read from standard input. Again, standard input can contain either
binary form or text. Finally, an argument that begins with an equal sign "=" is taken as a literal requirements source text, and is compiled
accordingly for use.
EXAMPLES
To compile an explicit requirement program and write its binary form to file "output":
csreq -r="identifier com.foo.test" -b output.csreq
To display the requirement program embedded at offset 1234 of file "foo":
tail -b 1234 foo | csreq -r- -t
FILES
DIAGNOSTICS
The csreq program exits 0 on success or 1 on failure. Errors in arguments yield exit code 2.
SEE ALSO
codesign(1)
HISTORY
The csreq command first appeared in Mac OS 10.5.0 .
BSD
June 1, 2006 BSD