Delete range of lines above pattern with sed (or awk)
I have the following code that will remove lines with the pattern banana and 2 lines after it:
I have the following code that will remove lines with the pattern banana and 2 lines after it:
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
I need to read the following input into separate columns as variables?
input.txt
I have a text file in an unknown or mixed encoding. I want to see the lines that contain a byte sequence that is not valid UTF-8 (by piping the text file into some program). Equivalently, I want to filter out the lines that are valid UTF-8. In other words, I’m looking for grep [notutf8].
I have a number of large CSV files and would like them in TSV (tab separated format). The complication is that there are commas in the fields of the CSV file, eg:
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:
I’m trying to see how many times foo bar appears in /var/log/foo.log within an arbitrary amount of time on a remote server, but nothing that I’ve tried so far has worked.
Having a file of the following contents:
There are specific lines that I want to remove from a file. Let’s say it’s line 20-37 and then line 45. How would I do that without specifying the content of those lines?
This is the data what I want to sort. But sort treats the numeric to string, the data it no sorted as I expected.