cut

How do you parse a filename in bash?

I have a filename in a format like: system-source-yyyymmdd.dat I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter. ...

Truncate stdin line length?

I've been parsing through some log files and I've found that some of the lines are too long to display on one line so Terminal.app kindly wraps them onto the next line. However, I've been looking for a way to truncate a line after a certain number of characters so that Terminal doesn't wrap, making it much easier to spot patterns. I wro...

Implementing copy, cut and paste

I want to implement copy, cut and paste in my drawing program (copy part of an image that is selected) I don't know how to start Any Ideas? ...

How do you pipe input through grep to another utility?

I am using 'tail -f' to follow a log file as it's updated: tail -f logfile I next pipe the output of that to grep to show only the lines containing a search term ("org.springframework" in this case): tail -f logfile | grep org.springframework The third step I'd like to make is piping the output from grep to a third command, '...

Is there a Perl substitute for the cut and paste shell commands?

I saw once a quick and dirty Perl implementation for the cut and paste linux commands. It was something like perl 'print "$F1"' filename to substitute a cut -f1 filename command Can someone tell me how was this Perl way? Specifically, I'm interested because this, unlike cut/paste, will work the same also in Windows environments. ...

OpenGL, remove sections from a shape

In OpenGL, how can one cut a triangle shaped hole from a square? making the hole transparent. I'm also using SDL, maybe it can be achieved with an SDL surface? ...

SIFR - LINK IN A LIST

I have a problem using sIFR for links in a list. When I try to apply it to the my links are perfectly skinned (with the right font and right color) but the last word of each link is cut or display on an other line. When I apply it to the the text is well displayed but appears as a hypertextlink (blue and underline). I have tryed an...

Using linux "cut" with stdin

I'm trying to pipe data into "cut" to, say, cut away the first column of text. This works $ cat test.txt | cut -d\ -f2- Reading from stdin also works: $ cut -d\ -f2- - ? doc/html/analysis.html ? doc/html/classxytree-members.html <CTRL+D> However, as soon as a pipe is involved, it doesn't accept my <CTRL+D> anymore, and I can't si...

BASH file attribute gymnastics: How do I easily get a file with full paths and privileges?

Dear Masters of The Command Line, I have a directory tree for which I want to generate a file that contains on two entries per line: full path for each file and the corresponding privileges of said file. For example, one line might contain: /v1.6.0.24/lib/mylib.jar -r-xr-xr-x The best way to generate the left hand column there appe...

unix cut, remove first token

I'm trying to use unix cut to remove the first two fields per line. I have input lines of of the form (token)(whitespace)(token)(lots of text) The problem is that there exit n tokens per line, so I can't do something like this cut -f3,4,5,6,7,8,9 is there a way to tell cut to take everything except the specified fields ...

linux ps aux command

How obtain the running process with absolute path name from ps command 13598 ? Ssl 0:00 /opt/something --run-id 2 -n /home/laks/f1 -l l.log I need the output as - /opt/something --run-id 2 -n /home/laks/f1 -l l.log ...

Parsing the first column of a csv file to a new file.

Operating System: OSX Method: From the command line, so using sed, cut, gawk, although preferably no installing modules. Essentially I am trying to take the first column of a csv file and parse it to a new file. Example input file EXAMPLEfoo,60,6 EXAMPLEbar,30,6 EXAMPLE1,60,3 EXAMPLE2,120,6 EXAMPLE3,60,6 EXAMPLE4,30,6 Desire output...

Override iPhone copy menu captions on a long-press?

Is it possible to override the captions in the "Copy" menu when the iphone user long-presses on some text? Essentially, I'd like to change the text to something like "Create a Note" instead of "Copy". Is that possible? ...

UNIX Parse HTML Page Display Contents of a Tag - One Liner?

I have an HTML file and I am interested in the data enclosed by <pre> </pre> tags. Is there a one-liner that can do achieve this? Sample file : <html> <title> Hello There! </title> <body> <pre> John Working Kathy Working Mary Working Kim N/A </pre> </body> </html> Output should be : John Kathy Mary Kim Much appreciat...

iPhone script to move,resize & cut image

my application needs to get some thumbnails. i have found some topics about resizing images proportionally but i need to do more: the user must zoom,move and cut the photo selecting a square 106*160, that will be used as thumbnail. is there any type of protocol to do that or shall I start writing a custom script? thank you all. ...

how to split a string in shell and get the last field

hi, suppose I have the string "1:2:3:4:5" and I want to get its last field ("5" in this case). how do I do that using Bash? I tried cut, but I don't know how to specify the last field with -f. ...

How to use unix scripts to show all 'n' characters long group of strings?

This IS kind of linked to another question - http://stackoverflow.com/questions/3171552/code-golf-color-highlighting-of-repeated-text I'm tying to figure out a way of breaking a file into all 'n' characters long groups. Eg: If a file comprises of ONLY the following text: ABCDEFGHIJ And we want it broken into sets of 3, the output sh...

how to get line cut after a sign

I have a lines: something ..fdfad ABCD info fdsafsda fae faefdsa fABCD info23 I want get line after ABCD ...

Stoping generator in first answer, use return instead

I am using too much to my taste the pattern (after every possible solution branch of the search). This is the code to find boggle words in given square. It had a bug if the words are not preselected to include only those whose letter pairs are neighbours, which I fixed now by changing comparrision not pos to pos is None. def word_path(w...

trunc the integer number from real number using matlab

please, any one help me to trunct the integer number from real number without any round to nearest integers in matlab ,e.g: if i have 255/64=3.98 I need just 3 not 4. I used fix in my program but not work. my cod is: S=imread('image0286.jpg')/64; disp(fix(S); this give me the output after rounds the elements of S to the nearest...