04-01-2016
Print nth previous line after match
Please help me
print nth line after match
awk or sed one line command.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
Need some idea on file processing, I have file like below,
Processing al sources ...
...No value found :
CHECK.
Completed comparing all sources.
Comparing schedulers...
Processing al targets ...
...No value found :
From above I need to extract the line where "No value... (4 Replies)
Discussion started by: braindrain
4 Replies
2. Shell Programming and Scripting
Hi,
I have many scripts in particular directory. And few of the scripts have exit 0 in second line. Now i wanted to list out the scripts name which has the exit 0 in its second line
I tried many options , but i can not get the filename along with the nth line pattern match :mad:. Can anyone... (14 Replies)
Discussion started by: puni
14 Replies
3. Shell Programming and Scripting
Hi,
I am looking for any script which can do the following.
have to read a pattern from fileA and copy it to fileB.
fileA:
...
...
Header
...
...
..p1
...
...
fileB:
....
....
Header (3 Replies)
Discussion started by: anilvk
3 Replies
4. Shell Programming and Scripting
Hi folks,
I've list of LDAP records in this format:
cat cmmac.export.tmp2
dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc
cmmac: 00:13:11:36:a5:06
dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc
cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies
5. Shell Programming and Scripting
Dear all,
How to print every nth line. File like this:
File input:
1
1
1
1
1
1
2
2
2
3
3
3
3
3
3 (3 Replies)
Discussion started by: attila
3 Replies
6. UNIX for Dummies Questions & Answers
Hi ,
I want to print the nth and n+1 lines from a file once it gets a pattern match.
For eg:
aaa
bbb
ccc
ddd
gh
jjjj
If I find a match for bbb then I need to print bbb as well as 3rd and 4th line from the match.. Please help..Is it possible to get a command using sed :) (6 Replies)
Discussion started by: saj
6 Replies
7. Shell Programming and Scripting
Bash/Oracle Linux 6.4
A basic requirement.
How can I get nth line of a file printed ? Can I use grep in this case ?
Example:
In the below file, 12th line is "Kernel parameter check passed for rmem_max" . I just want the 12 line to be printed.
# cat sometext.txt
Kernel version check... (2 Replies)
Discussion started by: John K
2 Replies
8. Shell Programming and Scripting
Hi All,
I have sample of listing as following
Database 2 entry:
Database alias = PXRES
Database name = PXRES
Local database directory = /db2/data1/db2phnx
Database release level = d.00
Comment ... (3 Replies)
Discussion started by: ckwan
3 Replies
9. Shell Programming and Scripting
Team,
I am writing a shell script to perform few health checks of the system, where I need to delete the previous line in the text file after pattern match using sed (or) awk.
Could you please help me out on this?
For example,
<td>
<td style=color:green align=center>
</td>
</tr>... (6 Replies)
Discussion started by: Nagaraj R
6 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I need to print the characters in the previous line just before the regular expression match
Please have a look at the input file as attached
I need to match the regular expression ^ with the character of the previous like and also the pin numbers
and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies