Hello,
I looked up on google but do not know from which point to start...
I am under ubuntu 18 bionic and Mainfile consists of 25K lines
MainFile:
ComparisonFile:
I wish to convert the MainFile into below format:
I thought that the algorithm should be like this:
1) read the line in the comparison file,
2) search space_$line in MainFile
3) if it returns, cut space_$line in MainFile ...just in case "$line" is coming after the last space in MainFile
4) put $line right after Test, phrase
Dear Vgersh99,
My idea: while read comparison file, grep each matching line > create a new file but then when I am gonna paste two files, it will fail I think. I do not like awk as I do not understand and unable to edit in my future needs. I suppose I need to learn how stuff works with awk command.
Please do not reply promptly. I am trying to learn awk command. Just let the baby crowl on the ground for 24h. Many thanks
Sure thing.
Here's my idea with awk:
1. read your ComparisonFile into an array indexed by $0 (hint: FNR==NR)
2. for each odd line in MainFile, substituting first , by itself appended with the last field on a line followed by : . Set a flag
3. If flag is set and you're on an even line, output the line and reset the flag.
@rdrtx1: still doesn't seem to suppress the records NOT in ComparisonFile, after the revision. And, it greps the ComparisonFIle 25k times ... might become lengthy.
Hi,
I have a file which is an extract of jil codes of all autosys jobs in our server.
Sample jil code:
**************************
permission:gx,wx
date_conditions:yes
days_of_week:all
start_times:"05:00"
condition: notrunning(appDev#box#ProductLoad)... (1 Reply)
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB and add/replace... (1 Reply)
I get a file which has all its content in a single row.
The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file.
I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
I am writing a shell script for some purpose. I have a variable of the form -- var1 = "policy=set policy"
Now I need to manipulate the variable var to get the string after index =. that is i should have "set polcy". Also I need to to this for many other variables where the value of "=" is not... (3 Replies)
How can I print a section of each line in a text file. Eg
CODE1 XYR Test2 10319389
CODE2 XYR Test2 10319389
CODE3 XYR Test2 10319389
CODE4 XYR Test2 10319389
CODE5 XYR Test2 10319389
First thing that would be nice would a new file like, awk sed and substring may help but can't figure it... (6 Replies)
How to manipulate first column and reverse the line order in third and fourth column as follws?
For example i have a original file like this:
file1
0.00000000E+000 -1.17555359E-001 0.00000000E+000
2.00000000E-002 -1.17555359E-001 0.00000000E+000
... (1 Reply)
Hi,
I would like to cut a specific line from a text file and then manipulate the text in that line.
For eg. below is "tmp" file.
-----------------
Tue 07/05/05 00:27:34.333
Tue 07/05/05 00:27:34.333 4 events were processed for customer 315 and will be correctly resolved when 315MERGE is run:... (2 Replies)