12-08-2008
Hi,
i tried
sed -n -e 'N; /No Value Found/p' yourfile.txt
but it only prints the previous line for the first match only.
thereafter only matching lines are printed and not their previous lines.
Thanks,
-srinivas yelamanchili
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello friends ,
I am doing the following command, but it is not wise to all files.
for temp in `find ./CSV/ -name "*.txt"`
do
sed -n -e 'N; /*Main End/p' $temp
done
Its give me the correct output for some files , but not for all files.
I mean some files contains the... (12 Replies)
Discussion started by: user_prady
12 Replies
2. Shell Programming and Scripting
Hi,
I need help for below scenario.I have a flat file which is having records seperated by delimiters which will represent each record for oracle table.My Control file will consider each line as one record for that table. Some of the lines are aligned in two/three lines so that records are... (4 Replies)
Discussion started by: kannansr621
4 Replies
3. 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
4. Shell Programming and Scripting
I have an application(Minecraft Server) that generates a logfile live. Using Crontab and screen I send a 'list' command every minute.
Sample Log view:
2013-06-07 19:14:37 <Willrocksyea1> hello*
2013-06-07 19:14:41 <Gromden29> hey
2013-06-07 19:14:42 Gromden29 lost connection:... (1 Reply)
Discussion started by: gatekeeper258
1 Replies
5. Shell Programming and Scripting
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies
6. Shell Programming and Scripting
Hello,
I have below format log file,
Comparing csv_converted_files/2201/9747.1012H67126.5077292103609547345.csv and csv_converted_files/22019/97447.1012H67126.5077292103609547345.csv
Comparing csv_converted_files/2559/9447.1012H67126.5077292103609547345.csv and... (6 Replies)
Discussion started by: arvindshukla81
6 Replies
7. Shell Programming and Scripting
I am trying to combine lines with these conditions:
1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text.
2. If condition1 is met then continue to combine lines through a line that ends with a semicolon.
3. Ignore case when matching patterns and remove any... (5 Replies)
Discussion started by: Wes Kem
5 Replies
8. AIX
Please help me
print nth line after match
awk or sed one line command. (3 Replies)
Discussion started by: sushma123
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
LEARN ABOUT DEBIAN
plan9-grep
GREP(1) General Commands Manual GREP(1)
NAME
grep, g - search a file for a pattern
SYNOPSIS
grep [ option ... ] pattern [ file ... ]
g [ option ... ] pattern [ file ... ]
DESCRIPTION
Grep searches the input files (standard input default) for lines that match the pattern, a regular expression as defined in regexp(7) with
the addition of a newline character as an alternative (substitute for |) with lowest precedence. Normally, each line matching the pattern
is `selected', and each selected line is copied to the standard output. The options are
-c Print only a count of matching lines.
-h Do not print file name tags (headers) with output lines.
-e The following argument is taken as a pattern. This option makes it easy to specify patterns that might confuse argument parsing,
such as -n.
-i Ignore alphabetic case distinctions. The implementation folds into lower case all letters in the pattern and input before interpre-
tation. Matched lines are printed in their original form.
-l (ell) Print the names of files with selected lines; don't print the lines.
-L Print the names of files with no selected lines; the converse of -l.
-n Mark each printed line with its line number counted in its file.
-s Produce no output, but return status.
-v Reverse: print lines that do not match the pattern.
-f The pattern argument is the name of a file containing regular expressions one per line.
-b Don't buffer the output: write each output line as soon as it is discovered.
Output lines are tagged by file name when there is more than one input file. (To force this tagging, include /dev/null as a file name
argument.)
Care should be taken when using the shell metacharacters $*[^|()= and newline in pattern; it is safest to enclose the entire expression in
single quotes '...'. An expression starting with '*' will treat the rest of the expression as literal characters.
G invokes grep with -n and forces tagging of output lines by file name. If no files are listed, it searches all files matching
*.C *.b *.c *.h *.m *.cc *.java *.cgi *.pl *.py *.tex *.ms
SOURCE
/src/cmd/grep
/bin/g
SEE ALSO
ed(1), awk(1), sed(1), sam(1), regexp(7)
DIAGNOSTICS
Exit status is null if any lines are selected, or non-null when no lines are selected or an error occurs.
GREP(1)