Skip to content

Magenaut

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

sed

How to grep lines between start and end pattern?

August 9, 2022 by Magenaut

I have a file which is having following content: zdk aaa b12 cdn dke kdn Input1: aaa and cdn Output 1: aaa b12 cdn Input 2: zdk and dke Output 2: zdk aaa b12 cdn dke I could use below commands to achieve: grep -a aaa -A2 file # Output 1 grep -a aaa -A4 … Read more

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

How do I substitute only first occurence with sed?

August 9, 2022 by Magenaut

Original file

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

How to report “sed” in-place changes

August 9, 2022 by Magenaut

When using sed to replace strings in-place, is there a way to make it report the changes it does (without relying on a diff of old and new files)?

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

Turning separate lines into a comma separated list with quoted entries

August 9, 2022 by Magenaut

I have the following data (a list of R packages parsed from a Rmarkdown file), that I want to turn into a list I can pass to R to install:

Categories Q&A, Unix & Linux Tags csv, linux, sed, tr Leave a comment

Replacing Multiple blank lines with a single blank line in vim / sed

August 9, 2022 by Magenaut

Question more or less says it all. I’m aware that /^$/d will remove all blank lines, but I can’t see how to say ‘replace two or more blank lines with a single blank line’

Categories Q&A, Unix & Linux Tags regular-expression, sed, vim Leave a comment

How to detect end of line with sed

August 9, 2022 by Magenaut

I’m looking for a way to only execute replacement when the last character is a newline, using sed.

Categories Q&A, Unix & Linux Tags newlines, regular-expression, sed Leave a comment

Replacing missing value blank space with zero

August 9, 2022 by Magenaut

I have input.txt tab-delimited text file around 30K lines, I would like to check each row (s1..s30K lines) for missing value (i.e blank space) and fill the missing value with zero value.See out.txt

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

How can I replace text after a specific word using sed?

August 9, 2022 by Magenaut

I have a file named .ignore. In need to replace the projdir. For example:

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

extract from line to line and then save to separate file

August 9, 2022 by Magenaut

I tried my luck with grep and sed but somehow I don’t manage to get it right.

Categories Q&A, Unix & Linux Tags command-line, grep, sed Leave a comment

What’s a good way to filter a text file to remove empty lines?

August 9, 2022 by Magenaut

I have a .csv file (on a mac) that has a bunch of empty lines, e.g.:

Categories Q&A, Unix & Linux Tags awk, sed, shell, text-processing Leave a comment
Older posts
Newer posts
← Previous Page1 … Page5 Page6 Page7 … Page11 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