Sponsored Content
Top Forums UNIX for Dummies Questions & Answers comparing field to current year Post 302440773 by keeferb on Wednesday 28th of July 2010 09:12:57 AM
Old 07-28-2010
Quote:
Originally Posted by rdcwayx
Code:
$ cat urfile
"smith","0000208352","08/25/2010 12:00:00 AM"
"smith","0000208352","06/25/2010 12:00:00 AM"
"smith","0000208352","07/25/2011 12:00:00 AM"
"smith","0000208352","08/25/2011 12:00:00 AM"
 
$ awk -v d="0801" -F "[\"/]" '{if ($6$7>d) print}' urfile
"smith","0000208352","08/25/2010 12:00:00 AM"
"smith","0000208352","08/25/2011 12:00:00 AM"

I think that's close, but not quite correct. I think you're only comparing the month and day. I probably didn't explain it clearly. Given your input file, the 7/25/2011 should be on the file because it is greater than 8/1 of the current year(2010). If I run this on 1/1/2011, only the 8/25/2011 would be on the new file because it would be the only one greater than 8/1/2011.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Comparing CRON PID w/Current PPID

All, I've got a script that needs to check if it was started by cron. The code seems to be right, but it's not running correctly if cron starts it. Am I getting the pid's correctly? I'm not having any luck figuring it out. :confused: Any help is appreciated! CRON_ID=$(ps -aef | grep... (1 Reply)
Discussion started by: GregWold
1 Replies

2. Shell Programming and Scripting

read file and print additional rows till current year

Hi all i have a file like 2006,1,2 2007,2,3 2008,3,4 I will read this and my output should be like 2006,1,2 2007,1,2 2008,1,2 2007,2,3 2008,2,3 2008,3,4 Giving the explanation, we will read the first line of the file and if the year any other than current year, we will print as many... (1 Reply)
Discussion started by: vasuarjula
1 Replies

3. Shell Programming and Scripting

Comparing current date

Hi, I have start date and end date in the following format. I need to check the current date is greater than the start date and less than the end date. if i use the command date --date "Tue 6:00 AM", it takes next Tues day not the current week's Tues day. Is there a way to get the current Tues... (9 Replies)
Discussion started by: bharathappriyan
9 Replies

4. Shell Programming and Scripting

ksh comparing current and previous lines

Hi, I am currently trying to work out how to compare one line with the last line I have read in via ksh. I have a file which has sorted output from a previous sort command so all the lines are in order already and the file would look something like show below. Each line has a name and a time... (5 Replies)
Discussion started by: paulie
5 Replies

5. UNIX for Dummies Questions & Answers

Comparing two files with datestamp to current date

Hi, I am new to unix and I am stuck on how to compare two .zip file with date stamp in my directory. I need to compare out of the two file which is oldest to current date and unzip it after that done continue to unzip the second zip file. Thanks for your help. (5 Replies)
Discussion started by: lilvi3tboix1
5 Replies

6. Shell Programming and Scripting

Compare Field in Current Line with Field in Previous

Hi Guys I have the following file Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above: Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies

7. UNIX for Dummies Questions & Answers

Change time with current year

Hi, How can i change the time below (red font) with the current year? Thank You in advance. hostname 2007-Feb-9 /u100/DEVCO/Patching a.log hostname 2010-Jun-25 /u100/DEVCO/DumpCleaner a.log hostname 2011-Jun-25 /u100/DEVCO/DumpCleaner/sample a.log hostname 23:44-Jun-25... (2 Replies)
Discussion started by: lienyca
2 Replies

8. Shell Programming and Scripting

How to pass current year and month in FOR LOOP in UNIX shell scripting?

Hi Team, I have created a script and using FOR LOOP like this and it is working fine. for Month in 201212 201301 201302 201303 do echo "Starting the statistics gathering of $Month partitions " done But in my scripts the " Month " variable is hard-coded. Can you please any one... (3 Replies)
Discussion started by: shoan
3 Replies

9. Shell Programming and Scripting

Comparing the dates with the current date in perl scripting

Hi i have a file containg dates likebelow 4/30/2013 3/31/2013 4/30/2013 4/16/2013 4/30/2013 4/30/2013 5/30/2013 5/30/2013 4/30/2013 5/30/2013 5/30/2013 3/31/2013 now i want to compare the above dates with current date and i want to display the difference . (10 Replies)
Discussion started by: siva kumar
10 Replies

10. HP-UX

Comparing the timestamp of the file to current time

I have a file like this -rwxr-xr-x 1 rewq other 168 Jan 13 07:05 check_files.sh I want to compare (check_files.sh time) with the current time to see if its is older than 2 hours or not if it is not older than 2 hrs then do something.can someone help me on this?.I dont... (7 Replies)
Discussion started by: haadiya
7 Replies
FS_LISTQUOTA(1) 					       AFS Command Reference						   FS_LISTQUOTA(1)

NAME
fs_listquota - Displays quota information for a volume SYNOPSIS
fs listquota [-path <dir/file path>+] [-human] [-help] fs listq [-p <dir/file path>+] [-hu] [-he] fs lq [-p <dir/file path>+] [-hu] [-he] DESCRIPTION
The fs listquota command displays information about the volume containing each specified directory or file (its name, quota, and amount of disk space used), along with an indicator of the percentage of space used on the host partition. To display more information about the host partition, use the fs examine command. To set volume quota, use the fs setquota or fs setvol command. CAUTIONS
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes). OPTIONS
-path <dir/file path>+ Names a file or directory that resides in the volume about which to produce output. Partial pathnames are interpreted relative to the current working directory, which is also the default value if this argument is omitted. -human Print space in a "human-readable" format. Instead of always printing space in kilobytes, show disk space in kilobytes, megabytes, gigabytes, terabytes, or petabytes, as appropriate. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output displays information about the volume that houses each specified directory or file, in a tabular format that uses the following headers: Volume Name The name of the volume. Quota The volume's quota in kilobytes, or the string "no limit" to indicate an unlimited quota. Used The amount of space used. If -human is not specified, this value is in kilobytes. % Used The percentage of the volume's quota that is used (the "Used" statistic divided by the "Quota" statistic, times 100). Partition The percentage of space used on the partition that houses the volume. Although not directly related to how much of the user's quota is used, it is reported because a full partition can cause writing of data back to the volume to fail even when the volume has not reached its quota. EXAMPLES
The following example shows the output for the volume "user.smith": % fs listquota -path /afs/abc.com/usr/smith Volume Name Quota Used % Used Partition user.smith 15000 5071 34% 86% PRIVILEGE REQUIRED
The issuer must have the "r" (read) permission on the ACL of the root directory of the volume that houses the file or directory named by the -path argument, and "l" (list) permission on the ACL of each directory that precedes it in the pathname. SEE ALSO
fs_diskfree(1), fs_examine(1), fs_quota(1), fs_setquota(1), fs_setvol(1) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 FS_LISTQUOTA(1)
All times are GMT -4. The time now is 02:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy