Skip to content

Tag: sed

How to add a string to line 13 in my text file

I have a very large text file that is difficult to open in text editors. Lines 12 – 15 are: I would like to add: 3 196 to line 14 and then have a blank line between 3 196 and Atoms like it is currently. I tried: But it did not seem to change anything. Anyone know of how I

Insert text if column contains a number

I have a tab-delim file that looks like this It should be three columns but some rows are missing the second column (bacterial taxonomy). For these rows I want to move the number to a third column and insert some text (such as Unclassified). I have been attempting to modify some commands I found online to ins…

+ Regular Expression not working in sed

Team, I have a file with data as mention below. Expected Output: I am using sed its not working . Please Let me know how to achieve the above mention output. Answer This might work for you (GNU sed): This method matches the numbers at the front of the string with strings appended to the end of the line and

how to count repeated sentence in Shell

My expected result is like as below: I have found a way to deal with the issues, but my code is a little noisy. I was wondering if you could show me more high-efficiency way to achieve the goal.Thanks a lot. Answer If you’re lines are not already grouped, then you could use This will consume a lot of me…