Skip to content
Advertisement

Tag: sed

how to grep lines according to 6th field contents

I would like to know how to filter lines according to the mem usage: I would like to be able to find only the PIDs that (RES mem usage) exceed 5GB Explicitly, I have the following lines and I’d like to grep only the lines where the 6th field is larger than 5 GB EDIT: Note that sorting is not

Linux command to add a word after a specific line

we need to add the line <property name=”assumeHungTime” value=”600000″ /> after the line <bean id=”DataUnpacker” class=”com-packer” singleton=”false”> in one xml file . Please let me know the command to add it – using sed? Thanks, Ravikanth Answer The follwing sed command will do what you want.

Using a pipe (or) in sed

From a variable $(JS_SOURCES) containing something like make writes a file containing mod1,othermodule. It works with this code: And my question is Why can’t I replace the 3 expressions with one using pipes ? The shorter sed command doesn’t trim the string (the purpose of two of the expressions). Why doesn’t it work ? How to fix that (without resorting

sed – insert line after X lines after match

I have the following contents: Using sed, I want to insert line at the INSERT LINE HERE label. The easiest way should be: find text “function_1” skip 3 lines insert new line But none of the known sed options do the job. inserts new_text right after ‘function_1’ inserts new_text after each of the next 3 lines, following ‘function_1’ inserts new_text

Awk asking combine two files

I have combined two different files with Same Key by AWK command. And In case there is no key match compare to File1 and File2 then just put “ttt” instead. I have below AWK command. Example Combine File1 File2 Then Expected result My AWK Command Show I already tried to do few way like below But looks like this is

Using linux system commands in R to remove special characters

I’m trying to clean files using linux system commands in R I would like to use a command that removes special characters apart from the file separator (pipe delimited) In the example below it’s the slashes and additional quotation marks that I’m trying to get rid of I’ve used the command below, but it doesn’t appear to be removing the

sed – Piping a string before the last line in a file

I have a command that prints a single line. I want to add/pipe this line to a file, just above its last line. I just find an empty line in the correct place, above the last line. I notice that when I add any string as ‘$i foo’, the “foo” gets printed in the correct place, but I want the

Advertisement