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
Tag: sed
Remove only Alphabetic Character lines in a linux file by using Sed/Awk
I have a linux file. In that file, some lines are there merge as with numeric and alpha charcters. I want to remove only alpha characters lines.. Let us consider a file with the sample contents as below: remove only #Terry Kalkas Lans Road, Beaver Falls PA kind of lines. I want to see Please share your Ideas Answer You
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
How to manipulate text lines and Create two separate files for odd and even
How to manipulate text lines and Create two separate files for odd and even ? file 1: file 2: Answer I’d say This will print lines in inputfile that end with 1, 3, 5, 7, or 9 to file1 and all others to file2.
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
Grep out tags from git repo
Trying to sed out the different tags from my repo with shell: Returns, How can I grep out only the different tags as v1, v2, v3, v4: Answer What about good old grep and uniq :
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