I want to leave the unknown content between tags intact, but want to match all tags that use: and replace the surrounding tags with: I’ve come up with the following, but obviously it’s not working as in the second part it’s literally substituting “].*[<]/h2[>]” for each mat…
Tag: awk
Create files in subdirectories with the same name [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago. Improve this question Reading a list with A and B data in 2 columns, iterating row by row, I was createding a seri…
Unix – Replace column value inside while loop
I have comma separated (sometimes tab) text file as below: parameters.txt: with below code I try to loop through the file and do something I wanted to update the last column of the file to N if the above operation is successful, however below approaches are not working for me: sed ‘s/$f5/N/’ ̵…
IF statement for different lines [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago. Improve this question Question is simple, but I can’t find a fast and elegant way to solve. I want to decide…
multi pattern in sed -n
I know there are quite a few questions asked on this topic. But I need help in a case basis.When i try to put more than 3 pattern in the option, i will get the error like that… i only want to print the words in the brackets.. here is the sed command and the output… thanks… sample output Answ…
optimizing awk command for large file
I have these functions to process a 2GB text file. I’m splitting it into 6 parts for simultaneous processing but it is still taking 4+ hours. What else can I try make the script faster? A bit of details: I feed my input csv into a while loop to be read line by line. I grabbed the values from the
Remove newline before a match – Linux
I want to remove the newline before the </script> in my HTML file with a Linux command (sed, awk…). Sample input: Sample output: I tried different syntax, but none of them could do. Answer First of all, as mentioned in the comments Don’t parse XML with Regex! Never do it, never think about i…
Copying multiple text lines into a file after specified pattern using shell [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago. Improve this question I want to insert multiple line from file1 marked with pattern into a file2 using shell. The …
How to sort or rearrange numbers from multiple column into multiple row [fixed into 4 columns]?
I have 1 text file, which is test1.txt. text1.txt contain as following: Input: Condition: A1 and B1 -> for each A1 + (B1 + [Tn + Vn]) A1 should be in 1 column. B1 should be in 1 column. T1,T2,T3 and T4 should be in 1 column. V1,V2,V3 and V4 should be in 1 column. How do I sort it
Awk script to sum multiple column if value in column1 is duplicate
Need your help to resolve the below query. I want to sum up the values for column3,column5,column6, column7,column9,column10 if value in column1 is duplicate. Also need to make duplicate rows as single row in output file and also need to put the value of column1 in column 8 in output file input file output fi…