11-05-2012
Hi Bipinajith,
Thanks , for your prompt reply.
I am getting a message
grep: illegal option -- o
I am using ksh
The output without the -o option also seems to work, what are we trying to do by the -o option .
I am new to shell please pardon my ignorance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in)
This is on solaris
Can you help? (2 Replies)
Discussion started by: frustrated1
2 Replies
2. Shell Programming and Scripting
Hi,
I need to search for a multiple string pattern(5 key words) in a file(similar to a flat file) ,and i need to store the output in a another file .
In that file we may have mutiple occurrences of the key words.and i need only the unique.
kindly help out.
Thanks,
Mohana Krishnan (2 Replies)
Discussion started by: krishnan_6015@y
2 Replies
3. UNIX for Dummies Questions & Answers
In a file a pattern is occured many times randomly. Even it may appear more then once in the same line too. How i can get the number of times that pattern appeared in the file? let the file name is abc.txt and the pattern is "xyz".
I used the following code:
grep -ic "xyz" abc.txt
but it is... (3 Replies)
Discussion started by: palash2k
3 Replies
4. Shell Programming and Scripting
Hi,
I have two files viz,
rak1:
$ cat rak1
rak2:
$ cat rak2
sdiff rak1 rak2 returns:
I want the lines that got modified, changed, or deleted preceding with the section they are in.
I have done this so far: (1 Reply)
Discussion started by: rakeshou
1 Replies
5. Shell Programming and Scripting
I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
example:
in a file I have this.
gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin
if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies
6. UNIX for Dummies Questions & Answers
I need to search and count the occurrences of a pattern in a file. The catch here is it's a pattern and not a word ( not necessarily delimited by spaces). For eg. if ABCD is the pattern I need to search and count, it can come in all flavors like (ABCD, ABCD), XYZ.ABCD=100, XYZ.ABCD>=500,... (6 Replies)
Discussion started by: tektips
6 Replies
7. Shell Programming and Scripting
I've got a semicolon delimited file. I would like to search for fields that match a pattern, and not hardcoded eg "mth".
*th=something
If the delimited field fulfills this condition, eg. mth=value
I would like to print out both key and value for some number comparison.
eg. if value > "12"... (5 Replies)
Discussion started by: alienated
5 Replies
8. Shell Programming and Scripting
Hello sed gurus. I am using ksh on Sun and have a file created by concatenating several other files. All files contain header rows. I just need to keep the first occurrence and remove all other header rows.
header for file
1111
2222
3333
header for file
1111
2222
3333
header for file... (8 Replies)
Discussion started by: gary_w
8 Replies
9. Shell Programming and Scripting
Hi,
I have two files file1.txt and file2.txt. Please see the attachments.
In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
Discussion started by: saurabh kumar
9 Replies
10. Shell Programming and Scripting
Guys -
Need your ideas on a section of code to finish something up. To make a long story short, I'm parsing a print output file that goes to pre-printed forms. I'm intercepting it, parsing it, formatting it, cutting it up into individual pages, grabbing the text I want in zones, building an... (3 Replies)
Discussion started by: ampsys
3 Replies
print(1) User Commands print(1)
NAME
print - shell built-in function to output characters to the screen or window
SYNOPSIS
ksh
print [ -Rnprsu [n]] [arg...]
DESCRIPTION
ksh
The shell output mechanism. With no flags or with flag - or -, the arguments are printed on standard output as described by echo(1).
OPTIONS
The following options are supported:
-n suppresses new-line from being added to the output.
-R
-r (raw mode) ignore the escape conventions of echo. The -R option will print all subsequent arguments and options other than
-n.
-p causes the arguments to be written onto the pipe of the process spawned with |& instead of standard output.
-s causes the arguments to be written onto the history file instead of standard output.
-u [ n ] flag can be used to specify a one digit file descriptor unit number n on which the output will be placed. The default is 1.
EXIT STATUS
The following exit values are returned:
0 Successful operation.
>0 Output file is not open for writing.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
echo(1), ksh(1), attributes(5)
SunOS 5.10 15 Apr 1994 print(1)