Sponsored Content
Top Forums Shell Programming and Scripting Help changing date output with AWK Post 302407534 by EAGL€ on Thursday 25th of March 2010 04:49:24 PM
Old 03-25-2010
Quote:
Originally Posted by commobox
Thanks, but that didn't seem to do it. The date remained the same
If you are using Solaris then use "nawk or /usr/xpg4/bin/awk" instead of awk:

Code:
nawk -F\, '{split($NF,a,"[/\"]");{$NF="\""a[4]a[3]a[2]"\""}}1' OFS=\, FILE

and SED will only change standard output that is screen so u should redirect the SED solution to another file:

Code:
sed 's/"\(..\)\/\(..\)\/\(....\)"/"\3\2\1"/' file > myfile.csv

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

changing the date

I need to change the date of the UNIX server at work to 20 aug 2001. How do I do this? And will this affect any databases running, or do I need to bring all databases down? (2 Replies)
Discussion started by: JBX
2 Replies

2. UNIX for Dummies Questions & Answers

Changing Creation Date to a Prespecified Date of a File In Unix

Dear Expert, Is there a command to do that in Unix? In such a way that we don't need to actually "write" or modified the content. -- monkfan (4 Replies)
Discussion started by: monkfan
4 Replies

3. Linux

changing date

Hi, I want to create one user who has right to change the date in linux, (1 Reply)
Discussion started by: manoj.solaris
1 Replies

4. UNIX for Dummies Questions & Answers

send output of a file as input for changing date

Hi, Please help me out on this one. I want to send the output of a file as input for changing the date using date command. Example, i have a file date.txt whose contents are 081014462009 I need to use the date in that file as input for date command. I tried cat date.txt | date ; but it... (2 Replies)
Discussion started by: foxtron
2 Replies

5. Shell Programming and Scripting

Getting a specific date from cal output with AWK

Hi guys! I'll make this short... Is there any good way to get the day number that first matches the Monday column from the cal command output with awk (or any other text manipulator commands) ? I'm sorry if my question wasn't clear at all. For example... One cal output would be $... (6 Replies)
Discussion started by: Casey
6 Replies

6. UNIX for Advanced & Expert Users

Date Conversion on output string from awk

Hi, I would like to convert the output from awk function to date and print on the screen. Example : echo "Start Date: May 24 2010" | gawk -F": " '{print $2}' Output : May 04 2010 I want this to be converted to 2010/05/24 Can i use date function here and how? Thanks, Deepika (2 Replies)
Discussion started by: deepikad
2 Replies

7. Shell Programming and Scripting

changing date to resemble "messages file" date

the following was taken from a perl script: my $date = strftime "%B %d %H:%M:%S", localtime; how can i modify it so this date outputs the date in the form of the date of the messages file. for example: Sep 20 11:48:44 As it is right now, the perl script outputs the date like this: ... (1 Reply)
Discussion started by: SkySmart
1 Replies

8. Shell Programming and Scripting

awk - append date to output of a command

Hi all; I am running a script:/var/tmp/gcsw -ne | grep "State:2" | wc that gives me output like:80 480 6529 but i need this output as:2013-01-18 13:00 -> 80 480 6529 (1 Reply)
Discussion started by: gc_sw
1 Replies

9. Shell Programming and Scripting

awk changing numbering in output file

The below awk is supposed filter $8 of example.txt using the each line in gene.txt. I think it is but why is it renumbering the 1,2,3 in $1 to 28,29,394? I have attached the data as it is large, example.txt is the file to be searched, gene.txt has the lines to match, and filtered.txt is the current... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

Changing CSV files with date . Subtracting date by values

Hi All, I have a CSV file which is as below. Basically I need to take the year column in it and find if the year is >= 20152 . If that is then I should subtract all values by 6. In the below example in description I am having number mentioned as YYWW so I need to subtract those by -5. Whereever... (8 Replies)
Discussion started by: arunkumar_mca
8 Replies
ucblinks(1B)					     SunOS/BSD Compatibility Package Commands					      ucblinks(1B)

NAME
ucblinks - adds /dev entries to give SunOS 4.x compatible names to SunOS 5.x devices SYNOPSIS
/usr/ucb/ucblinks [-e rulebase] [-r rootdir] DESCRIPTION
ucblinks creates symbolic links under the /dev directory for devices whose SunOS 5.x names differ from their SunOS 4.x names. Where possi- ble, these symbolic links point to the device's SunOS 5.x name rather than to the actual /devices entry. ucblinks does not remove unneeded compatibility links; these must be removed by hand. ucblinks should be called each time the system is reconfiguration-booted, after any new SunOS 5.x links that are needed have been created, since the reconfiguration may have resulted in more compatibility names being needed. In releases prior to SunOS 5.4, ucblinks used a nawk rule-base to construct the SunOS 4.x compatible names. ucblinks no longer uses nawk for the default operation, although nawk rule-bases can still be specifed with the -e option. The nawk rule-base equivalent to the SunOS 5.4 default operation can be found in /usr/ucblib/ucblinks.awk. OPTIONS
-e rulebase Specify rulebase as the file containing nawk(1) pattern-action statements. -r rootdir Specify rootdir as the directory under which dev and devices will be found, rather than the standard root directory /. FILES
/usr/ucblib/ucblinks.awk sample rule-base for compatibility links ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
devlinks(1M), disks(1M), ports(1M), tapes(1M), attributes(5) SunOS 5.10 13 Apr 1994 ucblinks(1B)
All times are GMT -4. The time now is 01:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy