Sponsored Content
Full Discussion: awk date too many open files
Top Forums Shell Programming and Scripting awk date too many open files Post 303011414 by mystition on Thursday 18th of January 2018 06:00:54 AM
Old 01-18-2018
awk date too many open files

Dear Community;

I have a csv file with msb and lsb in $3 and $5 fields which provides the epochtime (factor 65536). Further I need to convert epochtime to readable datetime.
But am getting an error.

File Sample:
Code:
5000a,1000,20671,0,16421,0,1,NULL,0
5000b,1000,20974,0,-16284,0,1,NULL,0
5000c,1000,20974,0,-16269,0,1,NULL,0
5000d,1000,20974,0,-16237,0,1,NULL,0
5000e,1000,20974,0,-16215,0,1,NULL,0
5000f,1000,20974,0,-16194,0,1,NULL,0
5000g,1000,20671,0,16421,0,1,NULL,0

Command:
Code:
awk -F, 'BEGIN {OFS = FS} {epochtime=($3*65536+$5)} {"date -r "epochtime"" | getline starttime} {$3=starttime; print}' offer_disabled.txt

Error:
Code:
awk: date -r 1374535870 makes too many open files
 input record number 33, file offer_disabled.txt
 source line number 1

Other Attempts (ref: similar issues)
Code:
awk -F, 'BEGIN {OFS = FS} {epochtime=($3*65536+$5)} {"date -r "epochtime"" | getline starttime; close(epochtime)} {$3=starttime; print}' offer_disabled.txt 

Or 

awk -F, 'BEGIN {OFS = FS} {epochtime=($3*65536+$5)} {"date -r "epochtime"" | getline starttime; close(starttime)} {$3=starttime; print}' offer_disabled.txt 

Or 
awk -F, 'BEGIN {OFS = FS} {epochtime=($3*65536+$5)} {"date -r "epochtime"" | getline starttime; close(epochtime); close(starttime)} {$3=starttime; print}' offer_disabled.txt 

Or 

awk -F, 'BEGIN {OFS = FS} {"date -r "$3*65536+$5"" | getline starttime; close(starttime)}  {$3=starttime; print}' offer_disabled.txt

But the same error is returned.

If I run line 33 output
Code:
date -r 1374535870

on CLI, it works fine.

Please guide on this issue.

########################

Just to add, am running this on OS X

########################


BR//
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sorting Files by date and moving files in date order

I need to build a k shell script that will sort files in a directory where files appear like this "XXXX_2008021213.DAT. I need to sort by date in the filename and then move files by individual date to a working folder. concatenate the files in the working folder then start a process once... (2 Replies)
Discussion started by: rebel64
2 Replies

2. Shell Programming and Scripting

Finding files and sorting by date (find | awk)

I am wanting to search a directory tree and return files that are older than a specified datetime. So far straight forward with find, now I want to sort in date order and format the output. So far I have this, but is not working and there is a problem with "." in the file and/or path names. ... (2 Replies)
Discussion started by: larry2311
2 Replies

3. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

4. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

5. Shell Programming and Scripting

awk throws makes too many open files

Hi, I have a below awk script. BEGIN { FS=","; } { system("curl -v -H \"Authorization: SSWS test" -H \"Accept: application/json\" -H \"Content-Type: application/json\" -X POST \"https://tes.test.com/api/v1/users?activate=false\" -d \'{ \"profile\": { \"firstName\": \"" $1 "... (7 Replies)
Discussion started by: Krrishv
7 Replies

6. Shell Programming and Scripting

Shell script to compare two files of todays date and yesterday's date

hi all, How to compare two files whether they are same are not...? like i had my input files as 20141201_file.txt and 20141130_file2.txt how to compare the above files based on date .. like todays file and yesterdays file...? (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies

7. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies

8. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

9. Shell Programming and Scripting

awk (Too many open files)

Hi Team, This is my first post, hope I am doing it right. I have a large file, like 6 GB. Its a proxy file so vendor requested to change username from logs for saving the confidentiality of the user. This is the script I created (With the help of Google): awk '{ tmp="echo " $5 " |... (12 Replies)
Discussion started by: tealc
12 Replies

10. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

current date command runs well awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat subtract 30 days fails awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies
shishi_enckdcreppart_starttime_set(3)				      shishi				     shishi_enckdcreppart_starttime_set(3)

NAME
shishi_enckdcreppart_starttime_set - API function SYNOPSIS
#include <shishi.h> int shishi_enckdcreppart_starttime_set(Shishi * handle, Shishi_asn1 enckdcreppart, const char * starttime); ARGUMENTS
Shishi * handle shishi handle as allocated by shishi_init(). Shishi_asn1 enckdcreppart input EncKDCRepPart variable. const char * starttime character buffer containing a generalized time string. DESCRIPTION
Set the EncTicketPart.starttime to supplied value. Use a NULL value for starttime to remove the field. RETURN VALUE
Returns SHISHI_OK iff successful. REPORTING BUGS
Report bugs to <bug-shishi@gnu.org>. COPYRIGHT
Copyright (C) 2002-2010 Simon Josefsson. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. SEE ALSO
The full documentation for shishi is maintained as a Texinfo manual. If the info and shishi programs are properly installed at your site, the command info shishi should give you access to the complete manual. shishi 1.0.1 shishi_enckdcreppart_starttime_set(3)
All times are GMT -4. The time now is 10:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy