cmurugavel
asked on
UNIX::SED::How to replace numericacharacter (lower case to upper case) in the .txt file ?
Hi,
I have a records like this in the file.txt:
20071010 Add 0 625306 1800076 USD 5y 1825 2555 32733.29
20071010 Add 0 625306 1800076 USD 3M 1825 2555 32733.29
20071010 Add 0 625306 1800076 USD 10y 1825 2555 32733.29
In the 7th field, I have a data 5y, 3M, 10y
I would like to change the all small letter to upper case (eg: 5y to 5Y and 10y to 10Y)
Can you tell me how can we do this in SED ?
I have tried with below command, but it's not showing correctly. Please advise.
sed 's/[0-9]*y/[0-9]*Y/g' file.txt
I have a records like this in the file.txt:
20071010 Add 0 625306 1800076 USD 5y 1825 2555 32733.29
20071010 Add 0 625306 1800076 USD 3M 1825 2555 32733.29
20071010 Add 0 625306 1800076 USD 10y 1825 2555 32733.29
In the 7th field, I have a data 5y, 3M, 10y
I would like to change the all small letter to upper case (eg: 5y to 5Y and 10y to 10Y)
Can you tell me how can we do this in SED ?
I have tried with below command, but it's not showing correctly. Please advise.
sed 's/[0-9]*y/[0-9]*Y/g' file.txt
sed s/y/Y/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I like to share the mark to ozo and tintin. Let me know how to do it
you can use sed to do that, however be careful of other letters in other columns..awk is a better tool to use. Unless you have restrictions on the tools to use, you can try this:
awk '{$7=tolower($7);print}' "file" > newfile
awk '{$7=tolower($7);print}' "file" > newfile