Is it possible to grep with a newline in the middle of an expression?
I'm hoping that there is a way to do this. I'm sure I won't be able to get the answer I need on the deadline I need it...but at least I'll learn how to solve this problem.
I have a file that looks like this:
Each line that starts with "Name" indicates a piece of equipment that I ran a query on. If it has AV yadda on the lines after it, then it responded to the query, if the next line is just another Name line, it did not. The problem is that I need to remove just the equipment that did not respond to the query.
The problem is, there are 96,000 pieces of equipment in this file alone, and I need to remove the ones that didn't respond so I can format the rest into a report (whole other issue).
The only way I can think to do this in a timely manner is some variation of the following:
Basically, I want to eliminate all lines that Start with Name, end with a MAC address, and are followed on the next line by Name.
Unfortunately as you can see, that's not working out too well. I've tried many different combinations of new line characters (\n) and start line/end line characters ($/^). But I still get the results above, not what I'm looking for.
I'm currently working in cygwin on my PC at work, but I also have access to Solaris 10 (the server where the file came from) and my personal ubuntu box.
The only other way I've been able to even come close to my goal is to run the following loop (where MACSQN is all of the MACs in the file, unsorted) which leaves me with two files, good MACs and bad MACs, but as there are 96K MACs to go through...it would take way to long to be useful.
im trying to find the best way to match an expression using grep.
input file is
<html>word word word word.</a>
<html>word word word word word word .</a>
<html>word word word word word word word word .</a>
<html>word word word word word word word word word word word word word word word word... (4 Replies)
Given a csv file with 40 columns with name, address, hometown etc.
I use a bash command in 1 line which:
1. gets the address column and pipes that to
2. grep the first digit and everything that follows
Command:
awk -F ";" '{print $19}' /Users/jb/Desktop/ReorderTempTotal.csv | grep -o "\d.*"... (7 Replies)
my file input is with tab as delimiter, and in every line, there would be a skip of line with an unexcepted newline breaker. I'd like to remove this \n and put the information in the same line.
INPUT
a1 b1b2 c1
c2 d1
a2 b3 c3 d4
OUTPUT
a1 b1b2 c1c2 ... (9 Replies)
Hi
While trying to do a search on solaris, the grep results seems to be appearing on the same line instead of the new line.
Wed Jan 18 14:45:48 weblogic@test:/abcd$ grep qainejb02 *
qa_cluster_biz_view_tc_intl_servers_ports_2:qainejb02 7101
qa_cluster_servers_2:qainejb02... (2 Replies)
Hi ,
I am having an issue with the Awk script to insert newline for a regular expression match
Having a file like this
FILE1
####################
RXOER , RXERA , RXERC , RXERD
.RXEA(RXBSN), RXERD , REXCD
input RXEGT
buffer RXETRY
#######################
Want to match the RXE... (38 Replies)
Hello everyone. I am new to unix, nice to meet you all.
I have a small problem with a question.
I have to write a command that finds all the postal codes in a txt file. All postal codes will begin on its own line in the txt file.
This is the formal of postal code: "A#A#A#" or "A#A #A#"
A... (3 Replies)
Hi,
I'm currently working on a shell script to automate a backup check on oracle database. My requirement is to grep the words between two delimiters and pass on to a variable..
for ex I have following values in my log file...
(DB_NAME), (163.24 25), (16/02/10 23:40), (COMPLETED),
I want... (5 Replies)
How can
grep G.*schema
give me the result: ${Gacntg_dt}""'"'
doesn't G.*schema say give me an unlimited number of characters between G and schema?
:confused: (3 Replies)
Hi
I have a problem using grep to find a pattern followed by newline.
Here is my file
xxxxxxxxxxxpattern
patternxxxxxx
pattern
xxxpattern
xxpatternx
xxxxxxyyyyxxxx
I want the result to be like this
xxxxxxxxxxxpattern
pattern
xxxpattern
Please help (2 Replies)
Hello All,
I have log file the result from a multithreaded process. So when a process finishes it will write to this log file as 123 rows merged.
The issue is sometimes the processess finish at the same time or write to the file at the same time as
123 rows merged.145 rows merged.
At... (5 Replies)