Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

awk

Find records present in file 1 also in both file 2 and file 3

August 7, 2022 by Magenaut

I have three files file1.txt, file2.txt, file3.txt and they are of same format.

Categories Q&A, Unix & Linux Tags awk, columns, shell-script, text-processing Leave a comment

Sed — Replace first k instances of a word in the file

August 7, 2022 by Magenaut

I want to replace only the first k instances of a word.

Categories Q&A, Unix & Linux Tags awk, sed, text-processing Leave a comment

Split a file into two

August 7, 2022 by Magenaut

I have a big file and need to split into two files. Suppose in the first file the 1000 lines should be selected and put into another file and delete those lines in the first file.

Categories Q&A, Unix & Linux Tags awk, csplit, split, text-processing Leave a comment

Delete range of lines above pattern with sed (or awk)

August 7, 2022 by Magenaut

I have the following code that will remove lines with the pattern banana and 2 lines after it:

Categories Q&A, Unix & Linux Tags awk, sed, shell-script, text-processing Leave a comment

What are the exact differences between awk and cut with grep?

August 7, 2022 by Magenaut

We know that we can get the second column of the line we want from a file using these two techniques: awk '/WORD/ { print $2 }' filename or grep WORD filename| cut -f 2 -d ' ' My questions are: What are the differences between the two commands above? Which one has the best … Read more

Categories Q&A, Unix & Linux Tags awk, cut, grep, performance Leave a comment

Adding a Column of values in a tab delimited file

August 7, 2022 by Magenaut

How can I add a Column of values in a file which has a certain number of rows.
I have a input file like this:

Categories Q&A, Unix & Linux Tags awk, linux, shell-script Leave a comment

Diff, show modified line from right file only

August 7, 2022 by Magenaut

I have file a and b and I would like to output lines of b that changed since it was cloned from a. Just the modified lines, no surrounding context, no diff offset marks.

Categories Q&A, Unix & Linux Tags awk, diff, sed, shell-script Leave a comment

How to remove multiple newlines at EOF?

August 7, 2022 by Magenaut

I have files that end in one or more newlines and should end in only one newline. How can I do that with Bash/Unix/GNU tools?

Categories Q&A, Unix & Linux Tags awk, bash, ed, sed Leave a comment

Efficient way to print lines from a massive file using awk, sed, or something else?

August 7, 2022 by Magenaut

If I had a plain-text file containing 8 million lines and I want to print out lines 4,000,010 to 4,000,000 to the screen, which would be more efficient: awk or sed? There is no pattern to the text, and unfortunately, a database isn’t an option. I know this isn’t ideal, I’m just curious on which … Read more

Categories Q&A, Unix & Linux Tags awk, performance, sed Leave a comment

Convert rows to columns

August 7, 2022 by Magenaut

I have a file that includes details about VMs running in a hypervisor. We run some command and redirect the output to a file. And the is data available in the below format.

Categories Q&A, Unix & Linux Tags awk, sed, text-processing Leave a comment
Older posts
Newer posts
← Previous Page1 … Page7 Page8 Page9 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress