Tagged Questions
10
votes
6answers
811 views
Linux tools to treat files as sets and perform set operations on them
Does anyone know of any linux tool specifically designed to treat files as sets and perform set operations on them? Like difference, intersection, etc?
2
votes
3answers
41 views
Regarding separate a single file into multiple files according to line separation
Currently, I have a plain text file, A, such as
lowest priority
very high significance.
outstanding
very novel
In this file, every line contains a sentence. I want to separate this file into ...
6
votes
4answers
107 views
extracting certain info from output
I'm trying to extract certain info from ffmpeg output.
Sample ffmpeg output:
configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver ...
0
votes
2answers
93 views
list the difference and overlap between two plain data set [closed]
Possible Duplicate:
Linux tools to treat files as sets and perform set operations on them
I have two data sets, A and B. The format for each data set is one number per line. For instance,
...
14
votes
7answers
1k views
how do you sort du output by size?
How do you sort du -sh /dir/* by size? I read one site that said use | sort -n but that's obviously not right. Here's an example that is wrong.
[~]# du -sh /var/* | sort -n
0 /var/mail
1.2M ...
8
votes
8answers
732 views
Is there a robust command line tool for processing csv files?
I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases cut, head, tail, and friends will do the job; however, cut cannot easily ...
11
votes
4answers
433 views
Command line friendly spreadsheets
Does such a thing exist? Text-based spreadsheets that display well in a CLI environment. I'm aware that I could cat foobar.csvand do as I please, but it isn't particularly practical or attractive. I ...
1
vote
2answers
274 views
regex find and replace 0x0D, 0x0A characters
I have a text file of a database dump with some line break characters (0x0A0x0D) in the middle of lines. I want to replace them with commas, but I can't do it simply, because those characters are the ...
5
votes
2answers
147 views
How to replace all the tabs in each file in a file system branch with 2 spaces each?
I code Scala and it's convention is to use double spaces per level for identiation. But using different editors makes my sources filled with a mix of spaces and tabs.
I'd like to refactor all the ...
2
votes
2answers
217 views
extract middle section of lines of a text file?
I am writing a php script to parse a large text file do to database inserts from it. However on my host, the file is too large, and I hit the memory limit for php.
The file has about 16,000 lines; I ...
3
votes
3answers
245 views
How do I grep without leading whitespaces?
I'm greping through a large codebase, and leading whitespaces and tabulation seem to be quite annoying. Is there any way to get rid of it?
grep -R "something" ./
E.g, instead of:
foo/bar.cpp: ...
2
votes
1answer
91 views
rotating buffer type file logging utility
I'am trying to debug a server that throws a lot of logs on stdout/stderr. I need to redirect only last N lines to a file. Something like a rotating buffer feature there in tcpdump's -C & -W flags. ...
9
votes
2answers
263 views
Where has the trailing newline char gone from my command substitution?
The following code best describes the situation. Why is the last line not outputting the trailing newline char? Each line's output is shown in the comment. I'm using GNU bash, version 4.1.5
...
1
vote
3answers
95 views
Get line numbers for empty lines
I have a large pipe-delimited file where I need to find the line number of all lines where a certain field is empty.
I can use cut -d \| -f 6 filename.txt to output just that column.
What is a ...
6
votes
2answers
1k views
Filtering invalid utf8
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 ...