Sponsored Content
Top Forums UNIX for Dummies Questions & Answers converting 6 digit column to dates format Post 85428 by Gerry405 on Wednesday 5th of October 2005 10:46:44 AM
Old 10-05-2005
dates

Hi Again Vino,


Sorry to be a pain but I now get an error..
UX:sh (./DateVino): ERROR: Bad substitution

#! /bin/sh
# gerry.sh
# input 071205
# output Dec 07 2005
# Base date is Oct 19, 2005.

touch -t 0509190000 /tmp/BASE

while read line
do
DAY=${line%????}
line=${line#$DAY}
MON=${line%??}
YR=${line#??}

case "$MON" in
"01") mon=Jan ;;
"02") mon=Feb ;;
"03") mon=Mar ;;
"04") mon=Apr ;;
"05") mon=May ;;
"06") mon=Jun ;;
"07") mon=Jul ;;
"08") mon=Aug ;;
"09") mon=Sep ;;
"10") mon=Oct ;;
"11") mon=Nov ;;
"12") mon=Dec ;;
esac
touch -t "$YR$mon$DAY0000" /tmp/FILEOLD
if [ "/tmp/FILEOLD" -nt "/tmp/BASE" ] ; then
echo "$mon $DAY $YR is newer"
else
echo "$mon $DAY $YR is older"
fi ;
done < gerry.txt

rm -f /tmp/BASE /tmp/FILEOLD
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Format dates

I have a date that is received as text in Jan 1 2002 12:00AM format. Can anyone give me any ideas how to format that in oracle format i.e. 01-JAN-02 (1 Reply)
Discussion started by: jinky
1 Replies

2. UNIX for Advanced & Expert Users

Select entries between two dates by converting Unix timestamp in Oracle Database.

Hi, I need to select the entries between two dates from an Oracle db. The Oracle db has a column with Unix timestamps. I use the following querry, but it doesnt seem to be working as desired. select count(*) from reporter_status where to_char(FIRSTOCCURRENCE, 'mm-dd-yy') between ('08-07-06')... (1 Reply)
Discussion started by: amitsayshii
1 Replies

3. Shell Programming and Scripting

Need script to generate all the dates in DDMMYY format between 2 dates

Hello friends, I am looking for a script or method that can display all the dates between any 2 given dates. Input: Date 1 290109 Date 2 010209 Output: 300109 310109 Please help me. Thanks. :):confused: (2 Replies)
Discussion started by: frozensmilz
2 Replies

4. Shell Programming and Scripting

Split large file based on last digit from a column

Hello, What's the best way to split a large into multiple files based on the last digit in the first column. input file: f 2738483300000x0y03772748378831x1y13478378358383x2y23743878383802x3y33787828282820x4y43748838383881x5y5 Desired Output: f0 3738483300000x0y03787828282820x4y4 f1... (9 Replies)
Discussion started by: alain.kazan
9 Replies

5. Shell Programming and Scripting

Dates not comparing correct even the same format

I have the date of the file passed into a variable also current date formatted same passed into a separate variable and compare the two with an if statement and statement always comes up false. Even though I verified the dates. Any help would be awesome. Filecrtdate=`ls -l $i | awk '{print... (19 Replies)
Discussion started by: coderanger
19 Replies

6. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

7. Shell Programming and Scripting

command for converting 4 column data to 1 column

dear friends I want to convert four column data to one column data. For example: from 1, 2, 3, 4 5, 6, 7, 8to 1 2 3 4 5 6 7 8what is the general command for that type of convertion. thanks (5 Replies)
Discussion started by: rpf
5 Replies

8. UNIX for Dummies Questions & Answers

Converting column to rows for every 3 lines in the column

Hi gurus! Please help me with this one. I have an file with the following contents: a b c d e f g h i j I would like to make to transform it to look like this as my output file: a,b,c d,e,f (4 Replies)
Discussion started by: kokoro
4 Replies

9. Shell Programming and Scripting

Converting Single Column into Multiple rows, but with strings to specific tab column

Dear fellows, I need your help. I'm trying to write a script to convert a single column into multiple rows. But it need to recognize the beginning of the string and set it to its specific Column number. Each Line (loop) begins with digit (RANGE). At this moment it's kind of working, but it... (6 Replies)
Discussion started by: AK47
6 Replies

10. UNIX for Dummies Questions & Answers

Converting dates to iso format

Hi , i am trying to read a tsv file record by record and change the date column with iso date format. it have different dates with format like mm/dd/yyyy HH:MM:SS EST ,i am trying serarch for the date format lke this yyyy-mm-dd HH:MM:SS EST and replace to it if dosent match that format . Any... (2 Replies)
Discussion started by: vikatakavi
2 Replies
pdtostd(1)						      General Commands Manual							pdtostd(1)

NAME
pdtostd - Convert profiling data files to standard format SYNOPSIS
pdtostd [-i] [-s] {[-a addrs] [-o outfile] infile}... OPTIONS
Retain "int" sized (32-bit) sample counts instead of truncating to "short" sized (16-bit) counts, as in the uprofile -i command in DIGITAL UNIX releases before V4.0. Split "int" sized (32-bit) sample counts into two "short" sized (16-bit) counts, so that default sample counts collected by cc -p or cc -pg cover one instruction instead of two, as in DIGITAL UNIX releases before V4.0. If infile is a pixie-created *.Counts file, then addrs is the name of a specific *.Addrs file to use. By default, pdtostd searches for a *.Addrs file in the location where the pixie program created it. The named file must be a "profiling data file", as reported by the file(1) command, not a standard for- mat *.Addrs file. Therefore, convert a *.Counts file before its *.Addrs file, unless using -o. The reformatted file is written to outfile instead of overwriting infile. Each infile can be preceded by a -o option. OPERANDS
The input file, which is a "profiling data file", as reported by the file(1) command, and was generated by a program instrumented or exe- cuted by one of the following tools: (mon.out) (gmon.out) (kmon.out) (umon.out) (*.Addrs, *.Counts) DESCRIPTION
The pdtostd command converts profiling data files from the format that the Tru64 UNIX profilers use into the older industry standard for- mats. The converted files can then be processed by tools compiled with the <cmplrs/prof_header.h> or <sys/gprof.h> files. The format of the profiling data files produced by Tru64 UNIX may be expanded in future releases, but Tru64 UNIX tools will continue to support older formats. To write tools that process profiling data files, the pdtostd command lets you convert the Tru64 UNIX formats to the older industry standard formats, where one exists. The standard formats cannot accommodate the variety of data that is recorded in the "profiling data file" format, but instead they provide the standard subset. The standard subset matches the format of the files output by the tools in DIGITAL UNIX systems before the V4.0 release. For access to the full information in a Tru64 UNIX profiling data file, examine the file with the pddump(1) command, and process it with the utilities in libpdf.a and <cmplrs/pdf.h>, skipping any new attributes, records, or fields that may appear. EXAMPLES
Converts a V4.* default mon.out file to a pre-V4.0 default mon.out file, without overwriting the original. pdtostd -s -o mon.std mon.out Converts pixie files, replacing the originals with the standard versions, even if the originals have been moved from the directory they were created in. pdtostd -a example.Addrs example.Counts example.Addrs FILES
Header file that defines the standard mon.out, kmon.out, and umon.out formats and the standard *.Addrs and *.Counts formats Header file that defines the gmon.h standard format SEE ALSO
Commands: atom(1), cc(1), file(1), kprofile(1), pddump(1), uprofile(1) AtomTools: pixie(5) Programmer's Guide pdtostd(1)
All times are GMT -4. The time now is 07:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy