Sponsored Content
Top Forums Shell Programming and Scripting Add additional numbers to file Post 302400385 by Pablo_beezo on Wednesday 3rd of March 2010 05:20:11 AM
Old 03-03-2010
Add additional numbers to file

I need to change the following field from:

Code:
"7/3/2009 7:07:12 PM","12345676","ok","8674"
"6/3/2009 8:07:12 PM","12345676","ok","8674"
"5/1/2009 7:07:12 PM","12345676","ok","8674"
"4/9/2009 3:07:12 AM","12345676","ok","8674"
"3/8/2009 3:07:12 PM","12345676","ok","8674"
"2/7/2009 4:07:12 PM","12345676","ok","8674"
"1/6/2009 5:07:12 PM","12345676","ok","8674"
"8/5/2009 6:07:12 PM","12345676","ok","8674"
"9/4/2009 9:07:12 PM","12345676","ok","8674"
"10/2/2009 10:07:12 PM","12345676","ok","8674"

to

Code:
"07/03/2009 19:07:12","12345676","ok","8674"
"06/03/2009 20:07:12","12345676","ok","8674"
"05/01/2009 19:07:12","12345676","ok","8674"
"04/09/2009 3:07:12","12345676","ok","8674"
"03/08/2009 15:07:12","12345676","ok","8674"
"02/07/2009 16:07:12","12345676","ok","8674"
"01/06/2009 17:07:12","12345676","ok","8674"
"08/05/2009 18:07:12","12345676","ok","8674"
"09/04/2009 21:07:12","12345676","ok","8674"
"10/02/2009 22:07:12 ","12345676","ok","8674"

I was trying sed which does not work, but I have about 1000 records, others with this type of format so it would probably need to be done in a loop?

I cannot get to add the 0 at the front of the date and cannot convert the 24hour process

I am using Korn Shell (solaris)

Last edited by zaxxon; 03-03-2010 at 06:24 AM.. Reason: use code tags please, ty
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add leading zeroes to numbers in a file

Hello, I am (trying) to write a script that will check to see how many users are logged on to my machine, and if that number is more than 60 I need to kill off all the oldest sessions that are over 60. So far I have been able to check how many users are on and now I am at the part where I have to... (3 Replies)
Discussion started by: raidzero
3 Replies

2. Shell Programming and Scripting

how to add line numbers in text file

Hi all How to add line numbers in text file.. ex abcd cdef result 1. abcd 2. cdef thx in advance (4 Replies)
Discussion started by: suryanarayana
4 Replies

3. AIX

How to add/remove additional DNS and IP to AIX

Hello, How to add/remove additional DNS and IP to AIX ? I wanted to add 3 more new DNS and IP addresses to existing AIX 5.2. (1 Reply)
Discussion started by: balareddy
1 Replies

4. Shell Programming and Scripting

Add numbers in a file

Hello, How to add numbers that are read from a file /tmp/test The content of the file look like 1234 234 432 1235 123 I read the file content in a for loop f=/tmp/test for i in `cat $f` do . . done Santhosh (11 Replies)
Discussion started by: mvsanthosh
11 Replies

5. UNIX for Dummies Questions & Answers

Add floating point numbers from file

How do I use bash to add all the floating point numbers saved in a file like this? 490.47 244.61 263.07 131.59 246.81 115.20 (3 Replies)
Discussion started by: locoroco
3 Replies

6. Shell Programming and Scripting

add a additional column in csv file

Thanks for allwoing me to discuss in this forum GIVEN BELOW A simple shell script which will ask for the user to input a PC name and it will produce the output in CSV with the PC name #! /bin/bash read -p "enter the PC name :" pc #checking for netstat report netstat -pant |sed '1,2d'... (1 Reply)
Discussion started by: ayyappancheta
1 Replies

7. Shell Programming and Scripting

How to add line numbers (multiples of 5: 0,5,10,15,20) to a text file?

Hi, I need to number the lines in my text file. I know how to do this with standard numbering (1,2,3,4, etc) but I need to count in multiples of 5, beginning 0,5,10,15... example existing file: abcd efg hijklm nopqrs desired output 0 abcd 5 efg 10 hijklm 15 ... (11 Replies)
Discussion started by: livbaddeley
11 Replies

8. AIX

Add additional swap place on AIX server

Can anyone help me the detailed procedure and commands to follow to add additional swap on aix server . My system shows following as of now , #lsattr -E -l sys0 -a realmem realmem 13893632 Amount of usable physical memory in Kbytes False #pstat -s PAGE SPACE: USED PAGES FREE... (7 Replies)
Discussion started by: gull05
7 Replies

9. Shell Programming and Scripting

awk to extract multiple values from file and add two additional fields

In the attached file I am trying to use awk to extract multiple values and create the tab-delimited desired output. In the output R_Index is a the sequential # and Pre_Enrichment is defaulted to .. I can extract from the values to the side of the keywords, but most are above and I can not... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. Shell Programming and Scripting

find -exec How to add additional parameter when calling a funtion

Hello Current working script is : # # my_script BEGIN # function a_function { FIRST_PARAM="$1" DO_SOMETHING "$FIRST_PARAM" } export -f a_function START_HERE="/home/some_user/Documents" find $START_HERE" -exec bash -c 'a_function "$0" ' {} \; (5 Replies)
Discussion started by: jcdole
5 Replies
Graphics::Primitive::Insets(3pm)			User Contributed Perl Documentation			  Graphics::Primitive::Insets(3pm)

NAME
Graphics::Primitive::Insets - Space between things DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds something. This object can be used to represent either padding or margins (in the CSS sense, one being inside the bounding box, the other being outside) SYNOPSIS
use Graphics::Primitive::Insets; my $insets = Graphics::Primitive::Insets->new({ top => 5, bottom => 5, left => 5, right => 5 }); METHODS
Constructor new Creates a new Graphics::Primitive::Insets. Instance Methods as_array Return these insets as an array in the form of top, right, bottom and left. bottom Set/Get the inset from the bottom. equal_to Determine if these Insets are equal to another. left Set/Get the inset from the left. right Set/Get the inset from the right. top Set/Get the inset from the top. zero Sets all the insets (top, left, bottom, right) to 0. AUTHOR
Cory Watson, "<gphat@cpan.org>" SEE ALSO
perl(1) COPYRIGHT &; LICENSE Copyright 2008-2010 by Cory G Watson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2010-08-21 Graphics::Primitive::Insets(3pm)
All times are GMT -4. The time now is 10:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy