Skip to content
Advertisement

Tag: sed

How to clean up masscan output (-oG)

I have a problem with the output produced by the masscan utility with the -oG options (“grep-able” output); for instance, it outputs this: The above is neither very readable nor easy to understand. How can I use Linux command-line utilities, e.g. sed, awk, or grep, to output something as follows, using the file above? As you can see, the output

linux sed, do insert and append at the same time

I have a question about linux sed command. I just want to insert something before every line and append something after every line. And i want to do these things at the same time. For example, assume file.txt is like: I need to output: so I think the command should be like: But the result is not right, a is

Adding additional newline between each line

I am analyzing log files from my server(particular few lines from there). But those lines are having around 1000 to 2000 characters in length. Here is an example how the lines are coming out with grep and less with following command. Output: But its hard for me to separate them as those are screen full of texts(also not pleasant for

find matching text and replace next line

I’m trying to find a line in a file and replace the next line with a specific value. I tried sed, but it seems to not like the n. How else can this be done? The file looks like this: And I’d like to change it to this Here’s what I tried: Answer This might work for you (GNU sed):

How do I grep out multiple lines of the same pattern?

I have a log file that is filled with exceptions that is not useful to me. It is being generated every two second and when looking at log file that contains 24 hrs of logging it becomes overwhelming to get to the relevant info I need. My logs look something like this: I want to clean up the copy of

How to append text to a specific lines in a file using shell script?

I have a text file (file.txt) having content something like: It contains the process and respective PID. Using shell script, I want to append a string (running/not running) to that lines in this file, according to the PID. For example, in the above file, for line containing PID 3696, I want to append a string “running” at the end, so

Advertisement