Sponsored Content
Top Forums Shell Programming and Scripting "Sed" while changing a key in a file Post 302300353 by vino on Tuesday 24th of March 2009 01:53:48 AM
Old 03-24-2009
If you have GNU sed, you can use the -i flag.

Else you may want to use perl. See if this works
Code:
perl -p -i -e "s|^$KEY.*|$KEY=$VALUE|g" $FILE

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

"sed" to check file size & echo " " to destination file

Hi, I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
Discussion started by: jockey007
7 Replies

2. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

3. Shell Programming and Scripting

Help to change the file with "sed" and "awk"

Hi experts I want your help to change the file format to my wanted version, please give me a hand thanks $cat file install pass make os pass make build kernel failed usb storage pass chane to | *install* | *make os* | *make build kernel* | *usb storage* | | pass | pass... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

4. Shell Programming and Scripting

"Join" or "Merge" more than 2 files into single output based on common key (column)

Hi All, I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations: 1. I am restrained to 2 input files only. 2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Discussion started by: Katabatic
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. UNIX for Dummies Questions & Answers

My question is all "03" records move to output file without changing

This is my input file 01,011600033,011600033,110516,0834,2,90,,2/ 02,011600033,011103093,1,110317,0834,,2/ 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+00000000354,,/ 49,+00000000000416920,00002/ 03,113806,,015,+00000559618,,,901,+00000000096,,,922,+00000000621,,/... (1 Reply)
Discussion started by: sgoud
1 Replies

7. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

8. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

9. Solaris

Changing "rx_queue_number" in "ixgbe.conf". Reboot or Network Restart?

Hi all, First post here. Working on Solaris 10, on a Sun t4-4, need to change RX queue depth(ethernet, not HBA) and was wondering if i could get by with just restarting the network or if i should just bounce the whole shebang. Apologies if i missed a similar thread. if there is one, please... (2 Replies)
Discussion started by: caspnx
2 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
UNI(8)							      System Manager's Manual							    UNI(8)

NAME
uni - a program to interface with the UniConf configuration system SYNOPSIS
uni get KEY [DEFAULT] uni set KEY [VALUE] uni xset KEY [VALUE] uni keys KEY uni hkeys KEY uni xkeys KEY uni dump KEY uni hdump KEY uni xdump KEY DESCRIPTION
UniConf is the One True Configuration system that includes all the others because it has plugin backends and frontends. Or, less grandiosely, it's a lightweight, distributed, cacheable tree of strings. uni is used to interface directly with the UniConf system. It's primary use is for diagnostic purposes, but it can be used to add UniConf support to shell scripts. ENVIRONMENT VARIABLE
UNICONF Before using uni, you must tell it which UniConf moinker you wish to query by setting this environment variable. Monikers are used to contact UniConf back-ends, be they a uniconfd server, or a local file. For example, they could be: o a filename (ini:/var/lib/app/config.ini), o or a network address, (tcp:open.nit.ca:4111). COMMANDS
get Retreive the VALUE associated with the provided KEY within the UniConf database. If a DEFAULT is provided, this will be returned if the KEY has no associated VALUE. set Assign the provided VALUE the the provided KEY. UniConf provides no guarentee that the entry committed throughout the database. The next "get" command for this KEY may not return the most recently "set" value due to caching, or the existance of a read-only generator. xset Assign, to the provided KEY, the contents of the standard-input stream. Use this command to pipe information into the UniConf data- base. keys List all the sub-keys contained within the provided KEY. hkeys List all the sub-keys, recursively, contained within the provided KEY. Since any KEY may contain sub-keys, UniConf provides no guarentee that there are no circular references. xkeys List all the sub-keys contained within the provided KEY, which can contain wildcards. See the WILDCARDS section. dump List all the sub-keys and their values, contained within the provided KEY. hdump List all the sub-keys and their values, recursively, contained within the provided KEY. xdump List all the sub-keys and their values, contained within the provided KEY, which can contain wildcards. WILDCARDS
A KEY looks just like a normal slash-delimited path. The root of the UniConf tree has a KEY named "/". Sub-keys can be accessed by names such as "/software/myapp/version". With wildcards, you can access more than one key at a time. * To access a sub-key within any one level of keys, use the asterix like so: "/software/*/version". This retrieves all keys of "ver- sion" that are one level beneath "/software". ... To access a sub-key anywhere beneath a key, use the ellipsis like so: "/.../version". This retrieves all keys of "version" that are zero or more levels beneath the root (i.e. any appearance of "version" within the database. SEE ALSO
uniconfd(8) AUTHORS
This software was written by the hackers at Net Integration Technologies. Contact us at <wvstreams-dev@lists.nit.ca> Uni 4.4.1 September 2004 UNI(8)
All times are GMT -4. The time now is 07:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy