Sponsored Content
Top Forums Shell Programming and Scripting [Solved] missing date in unix Post 302708033 by pamu on Monday 1st of October 2012 01:25:59 AM
Old 10-01-2012
Quote:
Originally Posted by rabindratech
Example:
MNP_Message_Gateway,Mg_Message_count,07-AUG-12,42
MNP_Message_Gateway,Mg_Message_count,20-AUG-12,24
Please look at your input file it is different than what you have given in the first post..

try this...
Code:
$ cat file
MNP_Message_Gateway,Mg_Message_count,07-AUG-12,42
MNP_Message_Gateway,Mg_Message_count,20-AUG-12,24

$ awk -F "[-,]" '{if(a){if(($3-a) > 1){p=$1","$2",";q="-"$4"-"$5",0";a++;for(i=a;i<$3;i++){a++;print p""i""q;}{print}}else{a=$3;print $0}}else{a=$3;print $0}}' file
MNP_Message_Gateway,Mg_Message_count,07-AUG-12,42
MNP_Message_Gateway,Mg_Message_count,8-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,9-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,10-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,11-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,12-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,13-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,14-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,15-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,16-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,17-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,18-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,19-AUG-12,0
MNP_Message_Gateway,Mg_Message_count,20-AUG-12,24


Last edited by pamu; 10-01-2012 at 02:41 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[SOLVED] mysql.sock is missing..

mysql.sock file is missing in /opt/lampp/etc/ is there any backup file available in unix... since without that file .. project is not opening.. reply me as soon as possible ... (19 Replies)
Discussion started by: senkerth
19 Replies

2. UNIX for Advanced & Expert Users

Solved: Missing whatis file from my /usr/shar/lib directory...

My whatis file is missing from my /usr/share/lib directory. I know I can recreate it by using catman -w command. My question is, why do all of my other servers have it and this one doesn't. Maybe due to a recent move of old to new servers and it just wasn't copied over. Unlikely, 'cause all... (0 Replies)
Discussion started by: zixzix01
0 Replies

3. Shell Programming and Scripting

[Solved] line breaks missing when emailed from unix to win

hi i am sending an email from unix to windows platform and using uuencode to attach the plain text files (.txt). But when i read the attached file in notepad the linebreaks are gone. uuencode samplefile.txt samplefile.txt | mail -s "test email" <mailid.com> if i copy paste the... (6 Replies)
Discussion started by: midhun19
6 Replies

4. Shell Programming and Scripting

Missing date

hi team, i have a file contains data as follows F1 file --------------------------- date system name 1-jan-2012 x 1-jan-2012 y 1-jan-2012 x 5-jan-2012 y 3-jan-2012 z 3-jan-2012 z 4-jan-2012 x 4-jan-2012 x ... (13 Replies)
Discussion started by: rabindratech
13 Replies

5. Red Hat

[Solved: Missing A Record] DNS issue

Hi, I have recently built a new DNS server and created a new zone. I use an ESMTP server to handle mail and the new domain has been added to this. I can send mail to gmail and other domain addresses but unable to send it to one particular domain. (DSN:Service Unavailable) DNS... (2 Replies)
Discussion started by: Duffs22
2 Replies

6. Solaris

[solved] Group sysadmin missing

Hello all I recently installed a fresh copy of Solaris. I noticed that /etc/passwd does not contain an entry for sysadmin Group #14. Why isnt it there? Other websites state that by default it should be there ! Help! Regards, Junaid ---------- Post updated at 01:04 AM ----------... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies

7. Shell Programming and Scripting

[Solved] Replace yesterday date with today's date except from the first line

Hello, I have a file like this: 2012112920121130 12345620121130msABowwiqiq 34477420121129amABamauee e7748420121130ehABeheheei in case the content of the file has the date of yesterday within the lines containing pattern AB this should be replaced by the current date. But if I use... (3 Replies)
Discussion started by: Lilu_CK
3 Replies

8. Solaris

[solved]Config/enable_mapping missing, how to add?

Issue resolved by upgrading from solaris 11 to solaris 11.1 I would like to enable network mapping. While using instructions from: https://blogs.oracle.com/VDIpier/entry/solaris_11_changing_the_hostname To change my hostname I noticed I am missing the enable mapping bool. What it should... (0 Replies)
Discussion started by: taltamir
0 Replies

9. Shell Programming and Scripting

Pipe output missing date?

I'd like to have the output from this script piped to a text file that has the date at the beginning of it. For example, my ideal would be something like this $./run_script.sh $ls *.out 2013-Feb-26-output_filename.out Here's the code I'm using. #! /bin/ksh DAT=`date '+%Y-%b-%d'` for... (2 Replies)
Discussion started by: DustinT
2 Replies

10. Shell Programming and Scripting

How to get the missing date and day in a table?

Hi Am using unix Aix Ksh Have Created table called vv and i have inserted two date Select * from vv; Output :- New_date 21/02/2013 24/02/2013 I have tried Using One query but Unsuccessful so far.. SELECT l.new_date + '1 day' as miss from vv as l (7 Replies)
Discussion started by: Venkatesh1
7 Replies
ppmtopgm(1)						      General Commands Manual						       ppmtopgm(1)

NAME
ppmtopgm - convert a portable pixmap into a portable graymap SYNOPSIS
ppmtopgm [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces a portable graymap as output. The output is a "black and white" rendering of the original image, as in a black and white photograph. The quantization formula used is .299 r + .587 g + .114 b. Note that although there is a pgmtoppm program, it is not necessary for simple conversions from pgm to ppm , because any ppm program can read pgm (and pbm ) files automatically. pgmtoppm is for colorizing a pgm file. Also, see ppmtorgb3 for a different way of converting color to gray. And ppmdist generates a grayscale image from a color image, but in a way that makes it easy to differentiate the original colors, not necessarily a way that looks like a black and white photograph. QUOTE
Cold-hearted orb that rules the night Removes the colors from our sight Red is gray, and yellow white But we decide which is right And which is a quantization error. SEE ALSO
pgmtoppm(1),ppmtorgb3(1),rgb3toppm(1),ppmdist(1),ppm(5),pgm(5) AUTHOR
Copyright (C) 1989 by Jef Poskanzer. 10 April 2000 ppmtopgm(1)
All times are GMT -4. The time now is 06:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy