this is my file.txt content. Here I’m trying to search pattern text: ‘About’ and remove items:[{ line with the command as below: file.txt: Command: sed -n -i -E ‘/text: ‘About’/{n; $p; x; d}; x; 1!p; ${x;p;}’ file.txt but it seems to be not working. Is there any way to make it work to remove line above pattern? Thanks in advance.
Tag: text-processing
Create CSV file using file name and file contents in Linux
I have a folder with over 400K txt files. With names like Each file has different content I want to grab file name and file content and put in CSV. Something like: I know how to grab all the files in a directory in CSV using: How can I also grab the contents of the file? Answer find * is
compare two excel sheet and print the difference?
I have two excel sheet (sheetA and sheetB) and I need to compare one column from sheetA with sheetB and print the difference. sheetA sheetB I need to compare “Account Number” with “Customer Number”. All account numbers from sheetA should be present in customer number in sheetB and if sheetB is missing any “account number” then we should print out
sed command to copy lines that have strings
I want to copy the line that have strings to another file for eg A file contain the below lines I want to copy the lines that has 100 or 200 to another file by skipping all the characters before (first occurrence in a line)100 or 200 I want it to copy 100 50 200 40 100 34 to another
Sed/awk: Aligning words in a file
I have a file with the following structure: I want to add another item to the file, using sed or awk: etc. So my next item looks like this: The column values is jagged. How do I align my values to the left like for previous items? I can see 2 solutions here: To align the values while inserting them
Read line by line and print matches line by line
I am new to shell scripting, it would be great if I can get some help with the question below. I want to read a text file line by line, and print all matched patterns in that line to a line in a new text file. For example: The intended output is as follows: I tried the following code: which
Storing awk manipulation in variable
I have two text files in tab delimted format like following. file_1 file_2 these two file contents were stored into two different variables. Now I would like extract the lines which has “+” symbol in column 4 and store it in the variable and later print it. But it throws me error message: Here is my code which I tried