Skip to content

Magenaut

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

cut

How to cut (select) a field from text line counting from the end?

August 11, 2022 by Magenaut

I know how to select a field from a line using the cut command. For instance, given the following data:

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

Can’t redirect cut output

August 10, 2022 by Magenaut

When I try to redirect the output of cut it always seems to be empty. If don’t redirect it, the output shows in terminal as expected. This is true for OS X 10.10 and Linux 4.1.6.

Categories Q&A, Unix & Linux Tags bash, cut, io-redirection, netcat Leave a comment

How to define ‘tab’ delimiter with ‘cut’ in Bash?

August 9, 2022 by Magenaut

Here is an example of using cut to break input into fields using a space delimiter, and obtaining the second field:

Categories Q&A, Unix & Linux Tags bash, cut Leave a comment

How to unbuffer cut?

August 8, 2022 by Magenaut

I want to get just e-mail addresses that end in “@xyz.nl” from my mail logfile. To achieve this I do:

Categories Q&A, Unix & Linux Tags cut, pipe Leave a comment

How to use grep and cut in script to obtain website URLs from an HTML file

August 8, 2022 by Magenaut

I am trying to use grep and cut to extract URLs from an HTML file. The links look like:

Categories Q&A, Unix & Linux Tags cut, grep, shell-script, string Leave a comment

get first X characters from the cat command?

August 7, 2022 by Magenaut

I have a text file I’m outputting to a variable in my shell script. I only need the first 50 characters however.

Categories Q&A, Unix & Linux Tags cat, cut Leave a comment

How to truncate text lines to N characters maximum?

August 7, 2022 by Magenaut

Given a text file, or the output of a command, how can I truncate it so that every line longer than N characters (usually N=80 in a terminal) gets shorten to N characters maximum? Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve … Read more

Categories Q&A, Unix & Linux Tags cut, 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

Counting occurrences of word in text file

August 7, 2022 by Magenaut

I have a text file containing tweets and I’m required to count the number of times a word is mentioned in the tweet. For example, the file contains:

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

Combining 2 different cut outputs in a single command?

August 6, 2022 by Magenaut

I have a file such as the following:

Categories Q&A, Unix & Linux Tags cut, text-processing Leave a comment
  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