awk - date problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk - date problem
# 1  
Old 11-08-2010
awk - date problem

hi guys;

the problem is to check if file has zero record. if it is NOT empty, i want to append date to a file. my code:
Code:
nawk '{if(NR!=0) {date "+%y%m%d-%H%M%S"}}' /home/gc_sw/new.txt >> /home/gc_sw/down.txt

but it fails??Smilie
# 2  
Old 11-08-2010
Please don't double post questions.

Continue here:

https://www.unix.com/shell-programmin...tent-file.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. Shell Programming and Scripting

date problem

hi everyone i have another date problem i need to find out the last week number and in that last week i need to find out at what day monday comes. please help (5 Replies)
Discussion started by: aishsimplesweet
5 Replies

4. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

5. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

6. AIX

problem with date

hi friends I am using AIX 5.2 version when ever i try to use echo $(date -d yesterday +"%Y%m%d") I am getting error as date: not recognized flag d please help me solve this. I wanted to find the next date from a given date. I tried using diff script but all of them failed at some... (5 Replies)
Discussion started by: sameerspice
5 Replies

7. Shell Programming and Scripting

problem with date

i have a process ---------------------------------------------------------------------- pipe 1044528 1278036 4 Dec 07 - 58:23 java -Xms128m -Xmx1024m -D_AppName=DBMaint com.eMeter.dbmaint.DBMaintAdapter /home/pipe/conf/appProperties/DBMaint.properties root 1073166 1134628 0 Feb... (2 Replies)
Discussion started by: ali560045
2 Replies

8. Shell Programming and Scripting

problem in date

Hai, i need the date should be older than 30 days input 14-02-2006 output 15-01-2006 Please help me (1 Reply)
Discussion started by: readycpbala
1 Replies

9. Shell Programming and Scripting

Problem with the date help

Hi everybody I have a problem with a shell. It runs every night just once a night on my sun system. #!/bin/ksh export pfad_work=/usr/users/ftp/testdaten export pfad_daten=/u01/projects/iris_unix/inp_test_daten/data export pfad_term=/u01/projects/iris_unix/inp_test_term/data cd... (2 Replies)
Discussion started by: Peterh
2 Replies

10. UNIX for Dummies Questions & Answers

date problem

when you typed date it gives an output: Fri Apr 12 10:07:59 MET DST 2002 how can i adjust this settings so it should read: Fri Apr 12 10:07:59 GMT 2002 i've already search the forum but the answer was never completed. by the way my UNIX is in solaris 7... ;) thanks. (2 Replies)
Discussion started by: inquirer
2 Replies
Login or Register to Ask a Question