This won't work. It will print all matching records to the file with the same name as $1, the OP wanted the newest record only, which judging by the sample input is the first occurrence only.
Why do you need egrep when only a single pattern is specified in the regex ?
Matrixmadhan,
Thanks for verifying my solution.
You are right about it -- for this specific case, I don't really need 'egrep'.
Matrix, I have a habit of always use 'egrep' no matter what.
This comes from the fact that I have had problems trying to use some full
regular expressions with 'grep' -- I had to specify the '-E' option.
Sometimes I found that out after a long headache.
From my last disaster, I promise myself to never use 'grep' again, always 'egrep'.
Matrix, also to reinforce my idea, all three versions of 'grep' in my system all have the same hardlink:
Which leads me to believe that they are all the same program.
Dear UNIX experts,
I'm a command line novice working on a Macintosh computer (Bash shell) and have neither found advice that is pertinent to my problem on the internet nor in this forum.
I have hundreds of .csv files in a directory. Now I would like to copy the subset of files that contains... (8 Replies)
Hello,
I want to get the maximum value of each record separated by empty line based on the 3rd column of each row within each record?
Input:
A1 chr5D 634 7 82 707
A2 chr5D 637 6 82 713
A3 chr5D 637 5 82 713
A4 chr5D 626 1 82 704... (4 Replies)
Hi All,
I have a requirement where I need to find sum of values from column D through O present in a CSV file and check whether the sum of each Individual column matches with the value present for that corresponding column present in the trailer record.
For example, let's assume for column D... (9 Replies)
I want records which have more than one and different value in the second column on the below sample file.
Ex, I have the samle file below :-
XYZ 1
XYZ 3
abc 1
abc 1
qwe 2
qwe 1
qwe 3
I want to select XYZ and QWE line only. (6 Replies)
Hi Gurus,
I know this'll be simple task for all the geeks out here but me being a newbie is finding it hard to crack this shell.
Ok coming to the task I've a delimited file as below
==================================================
====================================================
... (8 Replies)
Problem,
How can you pass today's date (eg) 18 into Awk and select the field representing the 18th column?
I have an output that I want to interact with based on what day it is
information=0:0 192:0 5436:0 22:99 0:0 0:0 1234:0 1359:09
DAY=date'+%d'
numbrs=`$information | awk... (2 Replies)
Hi there,
I have trouble selecting record that contain one biggest value for a group of other values. I mean, this is my table:
mysql> SELECT * FROM b;
+----+------+-------+
| id | user | value |
+----+------+-------+
| 1 | 1 | 100 |
| 3 | 1 | 150 |
| 5 | 1 | 300 |
| 6... (20 Replies)
Hi All,
I need to select only those records having a non zero record in the first column of a comma delimited file.
Suppose my input file is having data like:
"0","01/08/2005 07:11:15",1,1,"Created",,"01/08/2005"
"0","01/08/2005 07:12:40",1,1,"Created",,"01/08/2005"... (2 Replies)