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
times(2)							System Calls Manual							  times(2)

NAME
times - get process and child process times SYNOPSIS
DESCRIPTION
fills the structure pointed to by buffer with time-accounting information. The structure defined in is as follows: struct tms { clock_t tms_utime; /* user time */ clock_t tms_stime; /* system time */" clock_t tms_cutime; /* user time, children */ clock_t tms_cstime; /* system time, children */ }; This information comes from the calling process and each of its terminated child processes for which it has executed a or The times are in units of 1/seconds, where is processor dependent. The value of can be queried using the function (see sysconf(2)). is the CPU time used while executing instructions in the user space of the calling process. is the CPU time used by the system on behalf of the calling process. is the sum of the and of the child processes. is the sum of the and of the child processes. RETURN VALUE
Upon successful completion, returns the elapsed real time, in units of 1/of a second, since an arbitrary point in the past (such as system start-up time). This point does not change from one invocation of to another. If fails, (clock_t) -1 is returned and is set to indicate the error. Remarks has a granularity of one tick. Processes which run less than one tick may not register any value. ERRORS
fails if buffer points to an illegal address. The reliable detection of this error is implementation dependent. WARNINGS
Not all CPU time expended by system processes on behalf of a user process is counted in the system CPU time for that process. SEE ALSO
time(1), exec(2), fork(2), gettimeofday(2), sysconf(2), time(2), wait(2). STANDARDS CONFORMANCE
times(2)
All times are GMT -4. The time now is 02:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy