3
votes
3answers
54 views

Dynamically trim stdout line width in Bash

Lately, I have been experimenting with the ps command, and sometimes long paths wrap to the next line (or two) and make it hard to read. I want to pipe the ps output into another program to limit the ...
3
votes
3answers
145 views

Cut a field in a string with bash

I need to lower all upper-cases of file and folder names from a path, recursively inside other folders found; I need to do that with a bash script. Here my code: for file in $(find $1 -type f) do ...
6
votes
2answers
3k views

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

I know how to select a field from a line using the cut command. For instance, given the following data: a,b,c,d,e f,g,h,i,j k,l,m,n,o This command: cut -d, -f2 # returns the second field of the ...
2
votes
2answers
256 views

Manipulating and saving multiple files

I have ~2k files that I want to extract 12 of 26 columns and save the extracted information into a new file. I have been doing this for individual files using cat "oldfile.csv" | grep -v "=" | cut ...
3
votes
2answers
364 views

Cut on both characters and field

I have a record like : 2011-05-29 17:51:34 => 'HS|CMGC|RN431|CI13950|CH7-4a37-afe2-acabfc9d262d|DA110529|TI175133|' I want my final output to be something like: 2011-05-29 17:51:34 CI13950 I ...
9
votes
3answers
1k views

Can I make `cut` change a file in place?

The man page doesn't give me much hope, but I'm hoping it's an undocumented (and/or GNU-specific) feature.