text-processing
Using ‘sed’ to find and replace
The few, the brave.
concatenate lines based on first char of next line
I am looking for away contact lines based on the next line. So far the only way I see is to create a shell script that will read line by line and will do something along these lines:
sed command to replace a string from one file with entire contents of another file
This question already has answers here: How to ensure that string interpolated into `sed` substitution escapes all metachars (1 answer) Insert text from file inline after matching pattern in another file (3 answers) Closed 7 years ago. I want to write a sed (or awk) command to replace a string from one file with the … Read more
Find the line number which contains the pattern using custom regex delimiter
As in example I’m trying to get line numbers which contains the pattern. My pattern contains slashes so I wanted to add custom delimiter.
Insert new lines with missing values (NA)
I would like to insert new lines in text files if there are missing values.
I have for example the following text file (A.txt), for which line 5 is missing. In addition, as the file should have 12 lines the lines 11-12 are also missing.
Merging files by rows
Is it possible to copy the whole rows of File1 in a new File3 following the instruction given by File2 by using a simple bash script using sed or awk?
Merging columns from two separate files
How to create a new file merging selective columns from two separate files using awk? Without messing up the elements orders of BOTH files.
paste files without delimiter
How do I join two files vertically without any separator? I tried to use paste -d"" a b, but this just gives me a.
Search and replace strings that are not substrings of other strings
I have a list of replacements like so: