Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Search words in any quote position and then change the words

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-11-2017   -   Original Discussion by benjietambling
benjietambling benjietambling is offline
Banned
 
Join Date: Jan 2017
Last Activity: 11 January 2017, 7:23 PM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Search words in any quote position and then change the words

hi,

i need to replace all words in any quote position and then need to change the words inside the file thousand of raw.

textfile data :

Code:
  "Ninguno","Confirma","JuicioABC"
  "JuicioCOMP","Recurso","JuicioABC"
  "JuicioDELL","Nulidad","Nosino"
  "Solidade","JuicioEUR","Segundo"

need output like :

Code:
  "Ninguno","Confirma","Inciso"
  "Inciso","Recurso","Inciso"
  "Inciso","Nulidad","Nosino"
  "Solidade","Inciso","Segundo"

The criteria to be replace start with word "JuicioXXX"

Thanking you.



Moderator's Comments:
Search words in any quote position and then change the words Please use CODE tags as required by forum rules!

Last edited by RudiC; 01-11-2017 at 04:57 AM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old Unix and Linux 01-11-2017   -   Original Discussion by benjietambling
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 19 November 2017, 9:29 AM EST
Location: Aachen, Germany
Posts: 11,625
Thanks: 320
Thanked 3,617 Times in 3,322 Posts
Try

Code:
sed 's/"Juicio[^"]*"/"Inciso"/g' file
  "Ninguno","Confirma","Inciso"
  "Inciso","Recurso","Incisio"
  "Inciso","Nulidad","Nosino"
  "Solidade","Inciso","Segundo"

Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Gawk gensub, match capital words and lowercase words louisJ Shell Programming and Scripting 2 05-19-2014 11:58 AM
Put words to fix position in a file bahadiraktan Shell Programming and Scripting 6 11-18-2012 09:59 AM
Shell script to find out words, replace them and count words alex83 Shell Programming and Scripting 3 12-05-2010 05:18 PM
need help to position words upengan78 Shell Programming and Scripting 8 04-01-2010 01:25 PM
To Extract words from File based on Position kuttu123 UNIX for Dummies Questions & Answers 19 02-28-2010 09:32 AM



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