AIX Replace a substring


 
Thread Tools Search this Thread
Operating Systems AIX AIX Replace a substring
# 1  
Old 05-31-2010
[Solved] AIX Replace a substring

Hi,

I have a very simple problem but I am new to scripting and I cannot find a way around it.

I am using KSH.

I have a date say

Code:
001200AM

But i want to replace the first 00 to 12 so that the format will now be:

Code:
121200AM

Can anyone help me?
# 2  
Old 05-31-2010
Is that how exactly your file looks like, Otherwise give a good sample file...

Code:
# echo 001200AM | sed 's/^00/12/'
121200AM

This User Gave Thanks to malcomex999 For This Post:
# 3  
Old 05-31-2010
thanks! that worked! Smilie that is actually what i intend to do!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Replace substring by longest string in common field (awk)

Hi, Let's say I have a pipe-separated input like so: name_10|A|BCCC|cat_1 name_11|B|DE|cat_2 name_10|A|BC|cat_3 name_11|B|DEEEEEE|cat_4 Using awk, for records with common field 2, I am trying to replace all the shortest substrings by the longest string in field 3. In order to get the... (5 Replies)
Discussion started by: beca123456
5 Replies

2. Shell Programming and Scripting

Replace substring from a string variable

Hi, Wish to remove "DR-" from the string variable (var). var="DR-SERVER1" var=`echo $var | sed -e 's/DR-//g'` echo "$var" Expected Output: However, I get the below error: Can you please suggest. (4 Replies)
Discussion started by: mohtashims
4 Replies

3. AIX

AIX GUI to replace old school puTTy?

Is there now in existence a graphical interface for AIX instead of black screen on putty? I ask this, because IBM i has GUI interfaces. Maybe a navigator GUI for smitty etc also with powerVP enhanced? (2 Replies)
Discussion started by: dusktildawn
2 Replies

4. UNIX for Dummies Questions & Answers

Substring AIX ksh

I am trying to obtain a substring in AIX, but unable to obtain result ${var:1:3} ksh: ${var:1:3}: bad substitution (3 Replies)
Discussion started by: tostay2003
3 Replies

5. UNIX for Dummies Questions & Answers

AIX Replace CIFS by local FS

Hello Everybody, , I need some specific help… Straight to the point, I have a server AIX 5.3 with CIFS Windows Server Shared folder (see en example below ) //X.X.X.X/share$/folder1 /server/rep1/folder1 //X.X.X.X/share$/folder2 /server/rep1/folder2 //X.X.X.X/share$/folder1 ... (5 Replies)
Discussion started by: BEN1978
5 Replies

6. Shell Programming and Scripting

sed optimized for replace substring

Hi All, I have this text file IR7013903069171012INT10171211864 Axxxxxxxxxx12345dddddddddddd Byyyyyyyyy99999999ddddddddd IR7013903069171012TOS10171211865 Cffffffffff5745747ehdefffffffffgggggggg Dyyyyyyyyy99999999ddddddddd I need to 1) find lines where the substring IR70139 is... (5 Replies)
Discussion started by: gio123bgg
5 Replies

7. Shell Programming and Scripting

Advanced AWK Regexp substring to int & Replace

Hi! I have a difficult problem, to step up a unknown version number in a text file, and save the file. It would be great to run script.sh and the version gets increased. Example the content of the textfile.txt hello version = x bye This include three steps 1. First find the char after... (2 Replies)
Discussion started by: Beachboy72
2 Replies

8. AIX

Which command in AIX 5L is replace updatelv in AIX 4.3?

When I import VG, it shows: 0516-622 synclvodm: Warning, cannot write lv control block data. I found AIX V4.3 have updatelv command can recovery LVB from VG, however, updatelv is not existed on AIX 5L, which command to replace it? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

9. AIX

Replace a Failed Root Disk in AIX

My root disk is failed and how to replace the root disk in AIX. Can u give a detailed explanation in step wise. Pls give the answer taking different scenarios. Regards Praveen (1 Reply)
Discussion started by: chinnu_mulakala
1 Replies

10. AIX

Replace Screen With Model Tft Under Aix 5.1

Hello I want change screen in 7025 F40 with 19 " TFT Currently I have old screen 14 " With Smit I see that the card is GXT120P mga0 and size 330 x 250 mm and type is default. My question is: The changes are done automatically or I must change some parameters ??? . The boot is in graphic... (0 Replies)
Discussion started by: bustaf
0 Replies
Login or Register to Ask a Question