Tagged Questions
34
votes
8answers
44k views
Looping through files with spaces in the names?
I wrote the following script to diff the outputs of two directores with all the same files in them as such:
#!/bin/bash
for file in `find . -name "*.csv"`
do
echo "file = $file";
diff ...
20
votes
1answer
859 views
How to implement a horizontal cat? [duplicate]
Standard cat concatenates files line by line (row by row, if you will). I find myself needing a horizontal cat command more and more often recently; i.e. a command that takes a list of files and ...
5
votes
2answers
755 views
How to do a text replacement in a big folder hierarchy?
I want to search and replace some text in a large set of files excluding some instances. For each line, I want a prompt asking me if I need to replace that line or not.
Something similar to vim's ...
2
votes
3answers
213 views
Remove spaces and headers from a dumped database table
I have dumped the database table data into a flat file and below is how the data looks like : (Kindly copy from below
;metier_code ;
;-------------------------;
(0 rows affected)
...
5
votes
5answers
4k views
Parsing a delimited text file in bash as command arguments
I have a text file split up like so:
field1,field2,field3
xield1,xield2,xield3
dield1,dield2,dield3
gield1,gield2,gield3
Each of these columns will be a parameter to a program, and I would like ...
3
votes
4answers
1k views
Replacing text from a list of replacements. Added complication: backslashes
I have a file A that contains pairs of strings, one per line:
\old1 \new1
\old2 \new2
.....
I would like to iterate over file A, and for each line perform the replacement (e.g. "\old1 -> \new1") ...
2
votes
2answers
86 views
Scripting to domain allocation to server
I have two text files:
file #1: domain.txt
cocacola.com
airtel.com
pepsi.com
file #2: servers.txt
192.0.53.42 , 4 # 4 domains already allocated on server 192.0.53.42
192.53.1.2 , 1 # 1 ...