02-03-2012
The codes 1 and 2 are what I was looking for. Is there a way to add a blank line after the third line.
---------- Post updated at 06:16 PM ---------- Previous update was at 03:12 PM ----------
Never mind, I was able to figure it out.
awk '/Error/{print; getline; print; getline; print; print ""}' did the trick insertinbg ablank line.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
How do I use grep to find a pattern in a list of file and then display 5 lines after the pattern is matched
Eg:
I want to match the string GetPresentCode in all files in a folder and then see 4 lines following this match. I am not sure if grep is what should be used to achieve. Thanks!... (3 Replies)
Discussion started by: cv_pan
3 Replies
2. UNIX for Dummies Questions & Answers
I have a file with following data
A
B
C
D
E
F
G
H
I
K
L
M
N
and search pattern is G
Expected output (3 Replies)
Discussion started by: nsuresh316
3 Replies
3. UNIX for Dummies Questions & Answers
I have a file like this
DoctorName
Address1
Address2
DOB
InsuredName
Address1
Address2
DOB
PatientName
Address1
Address2
DOB
ClaimNo1
DoctorName
Address1
Address2
DOB
InsuredName (2 Replies)
Discussion started by: nsuresh316
2 Replies
4. UNIX for Dummies Questions & Answers
I have a file which has collection of segments occuring n(For eg.100) times
ISA
GS
ST
NM1*85
N3
N4
NM1*IL
N3
N4
REF*D9*1001
ISE
GE
SE
ISA
GS
ST
NM1*85
N3 (13 Replies)
Discussion started by: nsuresh316
13 Replies
5. Shell Programming and Scripting
Hi All,
I need to get the count of records in the file, if the passing parameter matches with the list of records in the file. Below is my example
source file: Test1.dat
20120913
20120913
20120912
20120912
20120912
20120912
20120912
20120913
20120913
20120912
In my script I am... (5 Replies)
Discussion started by: bbc17484
5 Replies
6. Shell Programming and Scripting
Hi,
Need help to grep the following from a file x. I just want to grep exact match not lines and not partial word.
CONFSUCCESS
CONFFAIL
CONFPARTIALSUCCESS
>cat x
xczxczxczc zczczcxx CONFSUCCESS czczczcczc
czxxczxzxczcczc CONFFAIL xczxczcxcczczc
zczczczcz CONFPARTIALSUCCESS czczxcxzc
... (4 Replies)
Discussion started by: rajeshwebspere
4 Replies
7. UNIX for Dummies Questions & Answers
URGENT HELP IS NEEDED!!
I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but
- Currently, script is not printing lines to File3.txt in order.
- Also the matching lines are not moving out of File1.txt
... (1 Reply)
Discussion started by: High-T
1 Replies
8. Shell Programming and Scripting
Hello,
I have a file contains two columns. I need to print the lines after “xxx” so i'm trying to match "xxx" & cut the lines after that. I'm trying with the grep & cut command, if there any simple way to extract this please help me.
Sample file :
name id
AAA 123
AAB 124
AAC 125... (4 Replies)
Discussion started by: Shenbaga.d
4 Replies
9. Shell Programming and Scripting
The below bash connects to a site, downloads a file, searches that file based of user input - could be multiple (all that seems to work). What I am not able to figure out is how to display on the screen match found or no match found" and write a file to a directory (C:\Users\cmccabe\Desktop\wget)... (4 Replies)
Discussion started by: cmccabe
4 Replies
10. Shell Programming and Scripting
Trying to combine the matching $5 values between file1 and file2. If a match is found then the last $6 value in the match and the sum of $7 are outputted to a new file. The awk below I hope is a good start. Thank you :).
file1
chr12 9221325 9221448 chr12:9221325-9221448 A2M 1... (5 Replies)
Discussion started by: cmccabe
5 Replies
LEARN ABOUT OPENSOLARIS
ttysrch
ttysrch(4) File Formats ttysrch(4)
NAME
ttysrch - directory search list for ttyname
DESCRIPTION
ttysrch is an optional file that is used by the ttyname library routine. This file contains the names of directories in /dev that contain
terminal and terminal-related device files. The purpose of this file is to improve the performance of ttyname by indicating which subdirec-
tories in /dev contain terminal-related device files and should be searched first. These subdirectory names must appear on separate lines
and must begin with /dev. Those path names that do not begin with /dev will be ignored and a warning will be sent to the console. Blank
lines (lines containing only white space) and lines beginning with the comment character "#" will be ignored. For each file listed (except
for the special entry /dev), ttyname will recursively search through subdirectories looking for a match. If /dev appears in the ttysrch
file, the /dev directory itself will be searched but there will not be a recursive search through its subdirectories.
When ttyname searches through the device files, it tries to find a file whose major/minor device number, file system identifier, and inode
number match that of the file descriptor it was given as an argument. If a match is not found, it will settle for a match of just
major/minor device and file system identifier, if one can be found. However, if the file descriptor is associated with a cloned device,
this algorithm does not work efficiently because the inode number of the device file associated with a clonable device will never match
the inode number of the file descriptor that was returned by the open of that clonable device. To help with these situations, entries can
be put into the /etc/ttysrch file to improve performance when cloned devices are used as terminals on a system (for example, for remote
login). However, this is only useful if the minor devices related to a cloned device are put into a subdirectory. (It is important to note
that device files need not exist for cloned devices and if that is the case, ttyname will eventually fail.) An optional second field is
used in the /etc/ttysrch file to indicate the matching criteria. This field is separated by white space (any combination of blanks or
tabs). The letter M means major/minor device number, F means file system identifier, and I means inode number. If this field is not speci-
fied for an entry, the default is MFI which means try to match on all three. For cloned devices the field should be MF, which indicates
that it is not necessary to match on the inode number.
Without the /etc/ttysrch file, ttyname will search the /dev directory by first looking in the directories /dev/term, /dev/pts, and /dev/xt.
If a system has terminal devices installed in directories other than these, it may help performance if the ttysrch file is created and con-
tains that list of directories.
EXAMPLES
Example 1 A sample display of /etc/ttysrch command.
A sample /etc/ttysrch file follows:
/dev/term MFI
/dev/pts MFI
/dev/xt MFI
/dev/slan MF
This file tells ttyname that it should first search through those directories listed and that when searching through the /dev/slan direc-
tory, if a file is encountered whose major/minor devices and file system identifier match that of the file descriptor argument to ttyname,
this device name should be considered a match.
FILES
/etc/ttysrch
SEE ALSO
ttyname(3C)
SunOS 5.11 23 Feb 1994 ttysrch(4)