![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Translating gcc/g++/gfortran Options to Sun Studio Compiler Options | iBot | Solaris BigAdmin RSS | 0 | 02-04-2009 02:30 PM |
| how to? launch command with string of command line options | TinCanFury | Shell Programming and Scripting | 5 | 04-28-2008 07:06 PM |
| JavaScript::Squish 0.07 (Default branch) | iBot | Software Releases - RSS News | 0 | 03-17-2008 08:00 PM |
| Associated array from command line options | jperret | Shell Programming and Scripting | 1 | 01-10-2008 05:16 PM |
| Executing command line options | Safia | High Level Programming | 8 | 07-04-2002 04:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
any way to squish several date options into one line?
this obviously isnt overly important, but its a bit slow and i was wondering if i could prevent it from re-searching the file several times. i want my matches from the previous and coming three days, as well as today. this is what i have but its weighty and im having trouble finding a way to slim it down.
cd ~/work grep -iT `date --date="3 days ago" "+%b%d"` les grep -iT `date --date="2 days ago" "+%b%d"` les grep -iT `date --date="1 days ago" "+%b%d"` les grep -iT `date "+%b%d"` les grep -iT `date --date="next day" "+%b%d"` les grep -iT `date --date="2 days" "+%b%d"` les grep -iT `date --date="3 days" "+%b%d"` les just need to spit out the lines starting with mmmdd, and im hoping to save some space/time. thanks nomkev |
|
||||
|
thats it. its just a function... i skipped the {} to save space.
edit: oops. the file. well it has names, but its basically a txt with: may24 name name may25 name name may26 name name etc... edit again: single digits are in the 'may01' etc Last edited by nomkev; 05-26-2009 at 11:42 AM.. |
|
||||
|
I didn't spot that you were ignoring case in your grep commands. Changes in bold red:
Code:
gawk '
BEGIN {
for (i=-3;i<=3;i++)
{
cmd="date --date=\"" i "days\" \"+%b%d\""
cmd | getline
close(cmd)
dy[tolower($0)]++
}
}
{ for (s in dy) if ($0 ~ "^" tolower(s) "[^0-9]") print }' les
|
![]() |
| Bookmarks |
| Tags |
| date, grep |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|