I’m using find to all files in directory, so I get a list of paths. However, I need only file names. i.e. I get ./dir1/dir2/file.txt and I want to get file.txt Answer In GNU find you can use -printf parameter for that, e.g.:
Tag: linux
dos2unix command
I have this script I want to remove “^M” charcaters from many files which are in more subdirectories. I got this: Is there somethig i’m missing? Thanks in advance. Answer I guess you don’t need a for loop. Here is a quick panorama of solutions for files with extension “.ext”…
Bash: How to tokenize a string variable?
If I have a string variable who’s value is “john is 17 years old” how do I tokenize this using spaces as the delimeter? Would I use awk? Answer Use the shell’s automatic tokenization of unquoted variables: If you want to change the delimiter you can set the $IFS variable, which stands …
How do I execute javascript programs from the Linux shell?
I would like to execute my javascript programs with the Rhino shell without making the first line #!/bin/sh. ‘#’ isn’t a comment character in javascript. I also don’t want to have to have a .js extension. Is this possible? I remember reading something a long while about a method of mak…
Apache LOG: child pid xxxx exit signal Segmentation fault (11)
Apache + PHP + Mysql + Linux [notice] child pid 23145 exit signal Segmentation fault (11), possible coredump in /tmp But nothing found under /tmp How can i find the error? Answer Endless loop of the function in PHP code caused this error.
How can I know if I am running in a 64bits or a 32bits linux from within a perl script?
I don’t want to directly access the shell (for example to use uname). I am looking for a fast-forward way to detect the architecture (only if it is 32 or 64 bits), once I know I am on linux. Answer There are 3 separate questions you could be asking: Note for all that there’s not a single magic …
how to print this in .xsl file?
I have .xsl file, in this file I want to print “<” how I can print ? Thanks in advance. Answer
How to send integer with pipe between two processes!
I am trying to send an integer with pipe in a POSIX system but write() function is working for sending string or character data. Is there any way to send integer with a pipe? Regards Answer The safe way is to use snprintf and strtol. But if you know both processes were created using the same version of compil…
Installing a graphics library on linux
I’m not a linux expert, and I’m trying to install a 2D graphics library on Ubuntu 10.10. I need to make a 2D display and after a little online research, GooCanvas seems like it will fit the bill. I’m frustrated because it simply won’t install and I don’t get what I am supposed to…