Displaying keyword search results 1 - 8
Created by magnum on June 20, 2011 20:52:22 Last update: June 21, 2011 08:44:01
Several ways to remove empty lines from a file with Unix utilities: Remove all empty lines with grep :
cat test.txt | grep -v '^\s*$'or
grep -v '^\s*$' test.txtRemove all empty lines with sed :
sed '/^\s*$/d' test.txtRemove empty lines at the beginning of file with sed :
sed '0,/\w/p' leadingBlankLines.txt | sed '0,/\w/d...
Created by woolf on May 20, 2011 14:00:35 Last update: May 20, 2011 14:01:36
To remove new line characters from a file: with tr :
tr -d '\n' < the-file.txtor
cat the-file.txt | tr -d '\n'with sed :
sed ':a;N;$!ba;s/\n//g' the-file.txtor
cat the-file.txt | sed ':a;N;$!ba;s/\n//g'The sed version is a bunch of commands to manipulate the register etc. Regex replace " s/\n//g " does not work because sed regex works on a single line. More tips from this Linux blog: http://linux.dsplabs.com.au/rmnl-remove-new-line-characters-tr-awk-perl-sed-c-cpp-bash-python-xargs-ghc-ghci-haskell-sam-ssam-p65/
Created by woolf on May 20, 2011 13:46:04 Last update: May 20, 2011 13:46:04
The Unix utility can convert a binary stream to hex and reverse it. The -p (or -ps ) switch means "plain", or "postscript" mode.
$ cat >test.txt Line one Line two Line th...
Created by voodoo on June 17, 2010 16:02:07 Last update: June 17, 2010 16:03:05
Use the uname command to display the SunOS version:
$ uname -a SunOS STAWOW1 5.10 Generic_142900-01...I can't find a command to display Solaris version. But the /etc/release file gives version information:
$ cat /etc/release Solar...This is a mapping of SunOS versions to Solaris versions: SunOS Version Solaris Version SunOS 5.4 Solaris 2.4 SunOS 5.5 Solaris 2.5 SunOS 5.5.1 Solaris 2.5.1 SunOS 5.6 Solaris 2.6 SunOS 5.7 Solaris 7 SunOS 5.8 Solaris 8 SunOS 5.9 Solaris 9 SunOS 5.10 Solaris 10 Reference: SUN Solaris Unix Commands and Scripts
Created by voodoo on January 17, 2010 00:15:47 Last update: January 17, 2010 00:15:47
A runlevel is used to group the daemons (services) to start. For the Fedora/Redhat based Linux systems, the primary runlevels are: runlevel 1: Single-User Mode runlevel 2: Multi-User Mode runlevel 3: Multi-User Mode with Networking runlevel 5: X11 (runlevel 3 + X Window System) The typical workstation runs in runlevel 5. Servers without X-server runs in runlevel 3. To determine what runlevel you are using:
# /sbin/runlevelTo determine what runlevel your system will boot with:
# cat /etc/inittab | grep :initdefault: id:5:in...To switch runlevels (replace RUNLEVEL with appropriate number):
# /sbin/init RUNLEVELWhen you switch runlevel, be sure that you are at a text console so that you don't accidentally kill your session when X-server is killed.
Created by Dr. Xi on December 12, 2007 20:30:01 Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf :
LoadModule python_module modules/mod_python.so ...Python script:
import time, os from os.path import basename ...
Created by Dr. Xi on June 01, 2007 18:00:58 Last update: June 01, 2007 18:00:58
Use the cut command to select specific fields or columns from a file:
cut -d: -f1,5 /etc/passwd # select usern...