Sponsored Content
Top Forums Shell Programming and Scripting Replace string of a file with a string of another file for matches using grep,sed,awk Post 303026462 by RudiC on Wednesday 28th of November 2018 06:44:43 AM
Old 11-28-2018
After reading your request several times I have a hard time precisely understanding what you need. Amongst other questions it's unclear what be
- the point you're stuck at with your attempts to a solution, and what you want changed.

- the structure of files under /tmp.
- the structure of entries to be modified.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed, grep, awk, regex -- extracting a matched substring from a file/string

Ok, I'm stumped and can't seem to find relevant info. (I'm not even sure, I might have asked something similar before.): I'm trying to use shell scripting/UNIX commands to extract URLs from a fairly large web page, with a view to ultimately wrapping this in PHP with exec() and including the... (2 Replies)
Discussion started by: ropers
2 Replies

2. Shell Programming and Scripting

Using sed to replace a string in file with a string in a variable that contains spaces

Hi, i call my shell like: my_shell "my project name" my script: #!/bin/bash -vx projectname=$1 sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp cp temp test_config_doxy the following error occurres: sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies

3. Shell Programming and Scripting

How to find a certain string in a file and replace it with a value from another file using sed/awk?

Hi Everyone, I am new to this forum and new to sed/awk programming too !! I need to find particular string in file1(text file) and replace it with a value from another text file(file2) the file2 has only one line and the value to be replaced with is in the second column. file 1: (assert (=... (21 Replies)
Discussion started by: paramad
21 Replies

4. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

5. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

6. Shell Programming and Scripting

sed or awk to replace a value in a certain line from another file containing a string

Hi experts, In my text file I have the following alot of lines like below. input.k is as follows. 2684717 -194.7050476 64.2345581 150.6500092 0 0 2684718 -213.1575623 62.7032242 150.6500092 0 0 *INCLUDE $# filename... (3 Replies)
Discussion started by: hamnsan
3 Replies

7. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

8. Shell Programming and Scripting

Help with Passing the Output of grep to sed command - to find and replace a string in a file.

I have a file example.txt as follows :SomeTextGoesHere $$TODAY_DT=20140818 $$TODAY_DT=20140818 $$TODAY_DT=20140818I need to automatically update the date (20140818) in the above file, by getting the new date as argument, using a shell script. (It would even be better if I could pass... (5 Replies)
Discussion started by: SriRamKrish
5 Replies

9. Shell Programming and Scripting

Replace string in XML file with awk/sed with string from another

Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file: </member> <member> <name>TransactionID</name> <value><string>123456789123456</string></value> </member> <member> <name>Number</name> ... (9 Replies)
Discussion started by: cozzin
9 Replies

10. Shell Programming and Scripting

Replace all string matches in file with unique random number

Hello Take this file... Test01 Ref test Version 01 Test02 Ref test Version 02 Test66 Ref test Version 66 Test99 Ref test Version 99 I want to substitute every occurrence of Test{2} with a unique random number, so for example, if I was using sed, substitution would be something... (1 Reply)
Discussion started by: funkman
1 Replies
XkbChangeMap(3) 						   XKB FUNCTIONS						   XkbChangeMap(3)

NAME
XkbChangeMap - Update only partial components of a keyboard description, modify the appropriate fields in the server and map components of a local copy of the keyboard description SYNOPSIS
Bool XkbChangeMap (Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes); ARGUMENTS
- dpy connection to X server - xkb description from which new values are taken - changes identifies component parts to update DESCRIPTION
To update only partial components of a keyboard description, modify the appropriate fields in the server and map components of a local copy of the keyboard description, then call XkbChangeMap with an XkbMapChangesRec structure indicating which components have changed. XkbChangeMap copies any components specified by the changes structure from the keyboard description, xkb, to the X server specified by dpy. If any components specified by changes are not present in the xkb parameter, XkbChangeMap returns False. Otherwise, it sends a request to the server and returns True. XkbChangeMap can generate BadAlloc, BadLength, and BadValue protocol errors. RETURN VALUES
True The XkbChangeMap function returns True if the components specified by changes are present in the xkb parameter. False The XkbChangeMap function returns False if the components specified by changes are not present in the xkb parameter. STRUCTURES
Use the XkbMapChangesRec structure to identify and track partial modifications to the mapping components and to reduce the amount of traf- fic between the server and clients. typedef struct _XkbMapChanges { unsigned short changed; /* identifies valid components in structure */ KeyCode min_key_code; /* lowest numbered keycode for device */ KeyCode max_key_code; /* highest numbered keycode for device */ unsigned char first_type; /* index of first key type modified */ unsigned char num_types; /* # types modified */ KeyCode first_key_sym; /* first key whose key_sym_map changed */ unsigned char num_key_syms; /* # key_sym_map entries changed */ KeyCode first_key_act; /* first key whose key_acts entry changed */ unsigned char num_key_acts; /* # key_acts entries changed */ KeyCode first_key_behavior; /* first key whose behaviors changed */ unsigned char num_key_behaviors; /* # behaviors entries changed */ KeyCode first_key_explicit; /* first key whose explicit entry changed */ unsigned char num_key_explicit; /* # explicit entries changed */ KeyCode first_modmap_key; /* first key whose modmap entry changed */ unsigned char num_modmap_keys; /* # modmap entries changed */ KeyCode first_vmodmap_key; /* first key whose vmodmap changed */ unsigned char num_vmodmap_keys; /* # vmodmap entries changed */ unsigned char pad1; /* reserved */ unsigned short vmods; /* mask indicating which vmods changed */ } XkbMapChangesRec,*XkbMapChangesPtr; DIAGNOSTICS
BadAlloc Unable to allocate storage BadLength The length of a request is shorter or longer than that required to minimally contain the arguments BadValue An argument is out of range X Version 11 libX11 1.5.0 XkbChangeMap(3)
All times are GMT -4. The time now is 01:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy