troubleshooting Question

How to replace nth column in a file

Avatar of nQuote
nQuoteFlag for Afghanistan asked on
Shell ScriptingLinux OS Dev
13 Comments2 Solutions1301 ViewsLast Modified:
I have several files, one of them is as follows:

A|2|Fghg|2|12/31/2013 01:00 PM\r\n
B|3|Ghkf|2|11/23/2012 02:00 PM\r\n

I would like to replace the nth column with a different value. For the example above, n=3.
There are no end-of-file terminators and there are DOS record delimiters.

Any help appreciated.
Join our community to see this answer!
Unlock 2 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros