How to remove empty/blank lines from a file in Unix (including spaces)?
This sed line should do the trick: sed -i ‘/^$/d’ file.txt The -i means it will edit the file in-place.
This sed line should do the trick: sed -i ‘/^$/d’ file.txt The -i means it will edit the file in-place.
Another way is to use this command in the batch file: echo exit | sqlplus user/pass@connect @scriptname
I have a little script that extracts archives, I found it somewhere on the net: extract () { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; *.tar.gz) tar xvzf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xvf $1 … Read more
Use the -f flag to print the canonicalized version. For example: readlink -f /root/Public/myothertextfile.txt From man readlink: -f, –canonicalize canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist
Another command that might be available and also works quite well for this is ‘blkid’. It’s part of the e2fsprogs package. Examples of it’s usage: Look up data on /dev/sda1: topher@crucible:~$ sudo blkid /dev/sda1 /dev/sda1: UUID=”727cac18-044b-4504-87f1-a5aefa774bda” TYPE=”ext3″ Show UUID data for all partitions: topher@crucible:~$ sudo blkid /dev/sda1: UUID=”727cac18-044b-4504-87f1-a5aefa774bda” TYPE=”ext3″ /dev/sdb: UUID=”467c4aa9-963d-4467-8cd0-d58caaacaff4″ TYPE=”ext3″ Show UUID data … Read more
You could run it silently using a Windows Script file instead. The Run Method allows you running a script in invisible mode. Create a .vbs file like this one Dim WinScriptHost Set WinScriptHost = CreateObject(“WScript.Shell”) WinScriptHost.Run Chr(34) & “C:\Scheduled Jobs\mybat.bat” & Chr(34), 0 Set WinScriptHost = Nothing and schedule it. The second argument in this … Read more
One of the tricks I follow is to put # in the beginning while using the rm command. root@localhost:~# #rm -rf / This prevents accidental execution of rm on the wrong file/directory. Once verified, remove # from the beginning. This trick works, because in Bash a word beginning with # causes that word and all … Read more
If you have installed the nginx package from the Ubuntu repositories, you will have two directories. /etc/nginx/sites-enabled and /etc/nginx/sites-available. In the main nginx configuration, /etc/nginx/nginx.conf, you have the following line: include /etc/nginx/sites-enabled/*.conf; So basically to list all available virtualhosts, you can run the following command: ls /etc/nginx/sites-available To activate one of them, run the following … Read more
The command you are looking for is called nslookup, works fine for reverse lookups IFF someone has configured a reverse zone file, which they don’t always do.
At least two ways: Use the — argument. cd — -2 This uses a convention common to GNU tools which is to not treat anything that appears after — as a command line option. As a commenter noted, this convention is also defined in the POSIX standard: Default Behavior: When this section is listed as … Read more