Sponsored Content
Full Discussion: Compare and eliminate
Top Forums Shell Programming and Scripting Compare and eliminate Post 302487680 by ghostdog74 on Thursday 13th of January 2011 08:00:11 AM
Old 01-13-2011
GNU awk
Code:
awk 'BEGIN{
  numdays =  86400 * 5
  now=systime()
}
{
  m=split($(NF-1),a,"-")
  yr=a[1]
  mth=a[2]
  day=a[3]
  t1=mktime(yr" "mth" "day" "00" "00" "00)
  if ( (now - t1) > numdays) {
   print
  }
}' file

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

boot messages - how to eliminate them

Anyone would know how to get rid off a message that comes up during a boot-up on Solaris? It says that the clusters for this software are not installed. I deleted the software because it was crashing some other stuff but it did not get rid off all the stuff. Yes, I am coming from windows and... (2 Replies)
Discussion started by: softarch
2 Replies

2. Shell Programming and Scripting

How to eliminate extra char?

I was trying to grep a variable with one space in my file: questionlabel=Q1 more job.tex Q1 pear Q1A applie grep -i "$questionlabel\ " job.tex > tmp But I keep getting : Q1 and Q1A both in my tmp Thanks!!!! (4 Replies)
Discussion started by: whatisthis
4 Replies

3. Shell Programming and Scripting

How to eliminate inf value in AWK

Hi, I have the calculations which return me infinity (inf), -inf, other very larger number when I printed them out. I did try to insert some control condition not to print these out if the above condition is met. The code I implemented is something like:- for (i=0;i<=1000;i++){ ... (3 Replies)
Discussion started by: ahjiefreak
3 Replies

4. Shell Programming and Scripting

Eliminate unwanted data

Hi, I am stuck on writing a script that reads a file, retains wanted data but discards unwanted data from a CSV file. This is a sample of my table {not the actual data) ID Color tel_num Name color2 color3 abcdef green 5551212 jj88 red blue acbdfe yellow... (5 Replies)
Discussion started by: t524ube
5 Replies

5. Shell Programming and Scripting

eliminate pathname from the file name in the o/p

Hi, Im finding some files form a specific path and den writing those files to another file as: find /SYS/admin/data/xml -name '*.xml' -type f ! -newer file1 -print >>out.xml and when im doing cat out.xml im getting like dis: ... (2 Replies)
Discussion started by: ss_ss
2 Replies

6. Shell Programming and Scripting

How to eliminate ^L

Hi, I am trying to create a text file from data retrieved from a query.The data retrieved is having this character '^L' at regular intervals of the data. How can i eliminate this, Please find below the sample data. I tried sed -e "s/\^L//g" to convert it, but with no luck ^LCODE*SERIAL... (11 Replies)
Discussion started by: ramkiran77
11 Replies

7. UNIX for Dummies Questions & Answers

[Solved] eliminate characters in vi

hey guys. what command in vi editor should I write to make this M83RDK-078A -1 1 1024 1 1024 OK X | M83RDK-055 -1 1 627 1 627 OK X | become like this M83RDK-078A 1 1024 M83RDK-055 1... (5 Replies)
Discussion started by: muhnandap
5 Replies

8. Shell Programming and Scripting

To eliminate the created filename

Hi All, I have two files in the directory file1.txt file2.txt I gave ls -m > output.txt command and I got the output as file1.txt, file2.txt, output.txt But my output should be like file1.txt, file2.txt Thanks in advance. (6 Replies)
Discussion started by: dubuku_01
6 Replies

9. Shell Programming and Scripting

Need help to eliminate the records

Hi All, Please help me how to remove the records from the file if it is having more number of fields than the required one, before loading into stage Here is the sample records. File is space delimited one chandu 1121324 CC ( 2 spaces) chandu balu 434657 DD (3 spaces) -- failing due to... (10 Replies)
Discussion started by: bbc17484
10 Replies

10. Shell Programming and Scripting

Eliminate comma on Field

Hi All, Seeking for your assistance on my problem below: What i did was extract the records from database and change the extension name to .csv. My problem is there is a records contains comma between records if i opened it in excel it will generate the comma as new field(please see below... (6 Replies)
Discussion started by: znesotomayor
6 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 10:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy