Sponsored Content
Full Discussion: replace word
Top Forums Shell Programming and Scripting replace word Post 302556396 by Scrutinizer on Sunday 18th of September 2011 10:25:49 AM
Old 09-18-2011
Code:
awk -F\| '{split($5,F," ");$5=F[2](F[3]==x?x:F[3])}1' OFS=\| file

-or-
Code:
awk '{sub(/[^|]*$/,x,$1)}1' OFS= file


Last edited by Scrutinizer; 09-18-2011 at 11:32 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to replace a word with another

Hi All, v_notes = "Ravi & kumar & garlapati" i want out put like "Ravi and kumar and garlapati" What is the command to get this as output, we have to replace all & with and. Hope this is clear. Regards, Ravi Kumar Garlapati (1 Reply)
Discussion started by: rkrgarlapati
1 Replies

2. Solaris

Replace word.

Dear I want to ask about replace word ( sharing word ) in files ( more than one files ) in one directory. Example:- I serach about ( ahmad ) in directory ( x ) i saw the results in ( 10 ) files ( differetn files ) i want to replace this word ( ahmad ) to ( Mohammad ) in one command. how i... (2 Replies)
Discussion started by: abu_hassan
2 Replies

3. Shell Programming and Scripting

Replace a word from a string

How can i replace a particular word from string i.e. var="shiv_dutt_para_shar" wrd="para" rep_wrd="PARA" what i am trying to do that first i'll search if $var catains #wrd or not. if it contains then i've to replace $wrd with $rep_wrd. I have tried following #!/bin/sh t="shiv... (5 Replies)
Discussion started by: jadoo_c2
5 Replies

4. Shell Programming and Scripting

Replace a word after a particular word in a file

Hi, I want to replace a word in a file which occurs after a particular word. For example : $cat file.txt CASE WHEN AND c1 = 'I' AND c2= '2' THEN 1 WHEN AND c1= 'I' AND c2= '0' THEN 2 So in this example i want to replace... (4 Replies)
Discussion started by: ashwin3086
4 Replies

5. Shell Programming and Scripting

How to replace a word with another word

Hello Friends, How to substitue with a word by another word in file written in VI Editor. Thanks & Regards Siva Ranganath 7760774961 (2 Replies)
Discussion started by: sivaranganath
2 Replies

6. Shell Programming and Scripting

Replace a word in a string starting with another word

Hi All, I have a file in which a number of lines are starting with similar first word but different next words. I want to replace the any nth word(not 1st or 2nd) with another word. Eg:- My file contains are like this:- Ram is a boy. Ram is a good boy. Ram plays cricket. Here I want to... (2 Replies)
Discussion started by: mukeshbaranwal
2 Replies

7. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

8. Shell Programming and Scripting

How to replace the word?

Hi Everybody, I am having a query like I want to change only first three patterns of the first line in a file. ex: I like unix unix unix unix is very much. after using the command it should be like I like linux linux linux unix is very much. Thanks, Naga (3 Replies)
Discussion started by: nagraju.allam
3 Replies

9. Shell Programming and Scripting

Shell Script @ Find a key word and If the key word matches then replace next 7 lines only

Hi All, I have a XML file which is looks like as below. <<please see the attachment >> <?xml version="1.0" encoding="UTF-8"?> <esites> <esite> <name>XXX.com</name> <storeId>10001</storeId> <module> ... (4 Replies)
Discussion started by: Rajeev_hbk
4 Replies

10. Shell Programming and Scripting

How do i replace a word ending with "key" using awk excpet for one word?

echo {mbr_key,grp_key,dep_key,abc,xyz,aaa,ccc} | awk 'gsub(/^|abc,|$/,"") {print}' Required output {grp_key,xyz,aaa,ccc} (5 Replies)
Discussion started by: 100bees
5 Replies
Locale::Codes::LangExt(3)				User Contributed Perl Documentation				 Locale::Codes::LangExt(3)

NAME
Locale::Codes::LangExt - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangExt; $lext = code2langext('acm'); # $lext gets 'Mesopotamian Arabic' $code = langext2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langext_codes(); @names = all_langext_names(); DESCRIPTION
The "Locale::Codes::LangExt" module provides access to standard codes used for identifying language extensions, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language extensions. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langext('acm','alpha'); $lext = code2langext('acm',LOCALE_LANGEXT_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from the IANA language registry, such as 'acm' for Mesopotamian Arabic. This is the default code set. ROUTINES
code2langext ( CODE [,CODESET] ) langext2code ( NAME [,CODESET] ) langext_code2code ( CODE ,CODESET ,CODESET2 ) all_langext_codes ( [CODESET] ) all_langext_names ( [CODESET] ) Locale::Codes::LangExt::rename_langext ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangExt::add_langext ( CODE ,NAME [,CODESET] ) Locale::Codes::LangExt::delete_langext ( CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_alias ( NAME ,NEW_NAME ) Locale::Codes::LangExt::delete_langext_alias ( NAME ) Locale::Codes::LangExt::rename_langext_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::delete_langext_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-02-27 Locale::Codes::LangExt(3)
All times are GMT -4. The time now is 08:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy