Skip to content

Magenaut

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

text-processing

How to delete all blank lines in the file with the help of python?

August 17, 2022 by Magenaut

For example, we have some file like that:

Categories Python, Q&A Tags python, text-processing Leave a comment

How to get only the unique results without having to sort data?

August 11, 2022 by Magenaut

$ cat data.txt aaaaaa aaaaaa cccccc aaaaaa aaaaaa bbbbbb $ cat data.txt | uniq aaaaaa cccccc aaaaaa bbbbbb $ cat data.txt | sort | uniq aaaaaa bbbbbb cccccc $ The result that I need is to display all the lines from the original file removing all the duplicates (not just the consecutive ones), while maintaining … Read more

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

Command to display first few and last few lines of a file

August 11, 2022 by Magenaut

I have a file with many rows, and each row has a timestamp at the starting, like

Categories Q&A, Unix & Linux Tags cat, head, logs, tail, text-processing Leave a comment

How can I double the newlines in an output stream

August 11, 2022 by Magenaut

When I have an output stream: a b c d e How can I double the newlines: a b c d e Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found … Read more

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

Best way to follow a log and execute a command when some text appears in the log

August 11, 2022 by Magenaut

I have a server log that outputs a specific line of text into its log file when the server is up. I want to execute a command once the server is up, and hence do something like the following:

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

Grabbing the first [x] characters for a string from a pipe

August 11, 2022 by Magenaut

If I have really long output from a command (single line) but I know I only want the first [x] (let’s say 8) characters of the output, what’s the easiest way to get that? There aren’t any delimiters.

Categories Q&A, Unix & Linux Tags command-line, shell, text-processing Leave a comment

Parse XML to get node value in bash script?

August 11, 2022 by Magenaut

I would like to know how I can get the value of a node with the following paths:

Categories Q&A, Unix & Linux Tags command-line, text-processing, xml, xmllint Leave a comment

Filter file by line number

August 11, 2022 by Magenaut

Given a file L with one non-negative integer per line and text file F, what would be a fast way to keep only those lines in F, whose line number appears in file L?

Categories Q&A, Unix & Linux Tags filter, high-performance, text-processing Leave a comment

Is there a tool that combines zcat and cat transparently?

August 11, 2022 by Magenaut

When handling log files, some end up as gzipped files thanks to logrotate and others not. So when you try something like this:

Categories Q&A, Unix & Linux Tags cat, compression, gzip, text-processing Leave a comment

Concatenate multiple files with same header

August 11, 2022 by Magenaut

I have multiple files with the same header and different vectors below that. I need to concatenate all of them but I want only the header of first file to be concatenated and I don’t want other headers to be concatenated since they are all same.

Categories Q&A, Unix & Linux Tags shell-script, text-processing Leave a comment
Older posts
Page1 Page2 … Page15 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