Search Results

Search: Posts Made By: MJKeeble
11,710
Posted By MJKeeble
Think I finally got it :) :) :) Code in...
Think I finally got it :) :) :)

Code in shell script

linedate="2/14/2013"
IFS="/" read mm dd yyyy <<EOF
$linedate
EOF
newvar=$(printf "%04d%02d%02d" $yyyy $mm $dd)
echo $newvar...
11,710
Posted By MJKeeble
I'm still not getting this ... I'm not sure what...
I'm still not getting this ... I'm not sure what IFS is .. The last set of instructions works, but what I really want is:

Read in data
field1 is everything up to first /
field2 is everything up...
11,710
Posted By MJKeeble
Sorry ... when I say "native unix" I mean typing...
Sorry ... when I say "native unix" I mean typing in the commands directly without using a script and executing the script. By the way ... I got this working with the following:
...
11,710
Posted By MJKeeble
I thought that might be needed, I was trying to...
I thought that might be needed, I was trying to type it in native unix, so thought it might be needed to type on one line

---------- Post updated at 11:58 AM ---------- Previous update was at...
11,710
Posted By MJKeeble
Trying to learn this on my own through trial and...
Trying to learn this on my own through trial and error, think it may be time to ask the big guns here ... will let you know .. thanks for your help ... This is not like Cobol :)
11,710
Posted By MJKeeble
okay ... running GNU bash, version...
okay ... running

GNU bash, version 3.2.51(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.


Please use code tags
11,710
Posted By MJKeeble
I typed linedat="12/12/2013"| echo...
I typed linedat="12/12/2013"| echo ${linedat:6:4}/${linedat:0:2} on the command line and all I got back was /

How do I tell what version of bash I'm using
11,710
Posted By MJKeeble
Linux /bin/bash Told you I was new to...
Linux
/bin/bash

Told you I was new to this :)
11,710
Posted By MJKeeble
Okay Here is what I entered ...
Okay

Here is what I entered


linedate="12/21/2013"
lineyyyy=${linedate:6:4}
linemm=${linedate:0:2}
linedd=${linedate:3:2}
echo $linedate $lineyyyy/$linemm/$linedd


nothing is...
11,710
Posted By MJKeeble
New to UNIX ... Date parsing
Hi ... extremely new to Unix scripting ... I have to get a date field from mm/dd/yyyy to yyyy/mm/dd format ... I have a variable that I want parsed. I don't seem to be doing it right?? Thanks.
Showing results 1 to 10 of 10

 
All times are GMT -4. The time now is 03:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy