![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to replace a character in the file? | ntgobinath | Shell Programming and Scripting | 2 | 06-04-2008 12:48 PM |
| to replace one character by numbers in a file | cdfd123 | Shell Programming and Scripting | 7 | 10-07-2007 07:25 PM |
| How to replace a character in a file | preethgideon | Shell Programming and Scripting | 6 | 08-30-2006 03:19 PM |
| How would you replace the n character in a file with some xyz? | JosephGerard | UNIX for Dummies Questions & Answers | 2 | 07-21-2005 05:46 AM |
| How would I replace the 9th character of every line in a file? | LordJezo | Shell Programming and Scripting | 5 | 09-01-2004 08:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Replace nth character in a file with a period
Hi all,
If you look at the example below,I want to replace the 21st character (,) with a period (.). I have 1000 records in a file can someone help me how to do that. Thankyou all in advance. "2008-07-15 05:35:16,103","Z467813","GET","/LoginDisplayAction.do",,,,"3476.0","/LoginDisplayAction.do" |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
awk '{print substr($0,0,20)"."substr($0,22)}' log > newlog
Code:
sed 's/,/./1' log > newlog |
|
#3
|
|||
|
|||
|
Code:
sed 's/,/./' log > newlog |
|
#4
|
|||
|
|||
|
Thank you very much, sed command solved my problem. Thank you once again
|
|||
| Google The UNIX and Linux Forums |