The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find and replace javeed7 Shell Programming and Scripting 1 04-02-2008 09:00 AM
find and replace rakshit Shell Programming and Scripting 4 01-24-2008 03:52 AM
find and replace mahabunta UNIX for Dummies Questions & Answers 7 09-21-2006 12:05 PM
find and replace valhutch UNIX for Dummies Questions & Answers 4 07-29-2006 05:20 PM
find and replace vikas_j@hotmail UNIX for Dummies Questions & Answers 3 02-25-2002 05:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-27-2001
gagansharma gagansharma is offline
Registered User
  
 

Join Date: Nov 2001
Location: India
Posts: 3
Question Find & Replace

I get a text file with 70+ columns (seperated by Tab) and about 10000 rows. The 58th Column is all numbers. But sometimes 58th columns has "/xxx=##" after the numeric data. I want to truncate this string using the script. Any Ideas...
  #2 (permalink)  
Old 11-27-2001
doeboy's Avatar
doeboy doeboy is offline
Registered User
  
 

Join Date: Oct 2001
Location: Here
Posts: 137
You could use sed to strip that string out of the lines that have it.
  #3 (permalink)  
Old 11-27-2001
gagansharma gagansharma is offline
Registered User
  
 

Join Date: Nov 2001
Location: India
Posts: 3
Thanks, but the problem is bigger. The string "/xxx=##" exists at many other columns too. Even the string along with the numeric data in 58th column exists at many other places.

e.g. I have row one A B C, row two B A C, row three A A A. And I need to change it to row one A B C, row two B D C, row three A D A. That is where ever there is A in Column two replace with D, leave rest as is.
  #4 (permalink)  
Old 11-27-2001
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Use "cut" to split the file into three pieces with the middle piece being the column you want to modify. Then modify it. Then use "paste" to reassemble the three pieces back to a single file.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0