awk - Unix: Grabbing dates from file and sorting them -
I have several files that look like this:
// file start $ Thing1 = {'item1' = & gt; '0', 'item2 = & gt; '3', 'MadDet' = & gt; '2013-10-01'}; $ Thing2 = {'item1' = & gt; '0', 'item2 = & gt; '3', 'MadDet' = & gt; '2012-11-01'}; $ Cheese3 = {'item1' = & gt; '0', 'item2 = & gt; '3', 'MadDet' = & gt; '2014-12-01'}; // File Termination Using Unix, what is the best way to catch all the items in a file of stars? I know that the item that I am looking for in the file
{somethingDate = '1111-11-11'} From this' 1111 -11'11 'file will contain more than one file requesting entries, and two files will contain many' fileTwoDate 'entries etc. My goal is to take all these dates, which are '* dated', remove duplicates, and sort them into the output file, which is quite easy using sort command and pipe though, I am stuck on this first part. Whatever I have yet looks like this:
& lt; I am now working with the command that captures dates & gt; | Sort-n & gt; Outputfile.txt I believe the way to go will be an AWK script what would be the correct way to parse these files?
Do you need it? {0} {0} / code>
If you have -r in the option sed , sed -nr "s / * '([0- 9] {4 } - [0-9] {2} - [0-9] {2}). * / / 1 / p " Test: < / p> Saturn: ~ # echo "{somethingDate = '1111-11-11'}" | sed -n "s /.* '\ ([0-9] \ {4 \} - [0- 9] \ {2 \} - [0- 9] \ {2 \} \) '. * / * 1 / p "1111-11-11 Saturn: ~ # Saturn: ~ # echo" $ item1 = {'item1' = & gt; '0', 'item2 = & gt; 3', 'itemdate' => 2013 -10-01 '', sed -n "s /.* '\ ([0-9] \ {4-} - [0- 9] \ {2 \} - [0- 9] \ {2 \} \) '. * / 1 / p "2013-10-01 < / Code>
Comments
Post a Comment