$/usr/platform/sun4u/sbin/prtdiag -v | more
Pages
▼
Wednesday, 16 November 2005
See number of CPUs in a SUN Solaris box
In a sun solaris box to see the number of CPUS in the box type the following at the prompt.
Kubilay
Thursday, 10 November 2005
Remove ^M from end of each line in Vi
Sometimes you might want to remove a character like '^M' from the end of each line in a vi file. This '^M' character is usually intrduced in the file if you transfer the txt or csv file from a windows environment to unix. It is the extra carriage return introduce in the end of line.
The command to do that is like this in Vi:
but to get the ^M you must press ctrl+v, then ctrl+m on your keyboard when at the vi prompt... it is one of those things
The command to do that is like this in Vi:
:%s/^M//g
but to get the ^M you must press ctrl+v, then ctrl+m on your keyboard when at the vi prompt... it is one of those things
Kubilay
Delete any blank lines in VI
The substitution command in vi to delete any blank lines in Vi editor open the file and type the command below at the VI command prompt.
$v/./d
Convert the entire file's case in VI
Using Vi editor you can convert the entire file to (U) uppercase or
(L) lowercase with the following command.
open the file in Vi and at Vi's command propmt type:
(L) lowercase with the following command.
open the file in Vi and at Vi's command propmt type:
%s/.*/\L&/
Kubilay
Use unix 'sed' to re-format csv files
Suppose you have a csv file which contains text like this
and you want to convert it to a CSV file so that you can use it in SQL,
something like this:
You can use a sed on unix to do it like this.
...
aaaa@bCC.com
cccc@dddddd.com.tr
lllll@kkkk.de
...
and you want to convert it to a CSV file so that you can use it in SQL,
something like this:
...
'aaaa@bCC.com',
'cccc@dddddd.com.tr',
'lllll@kkkk.de',
...
You can use a sed on unix to do it like this.
$ sed -e "/^$/d" -e "s/^/\'/" -e "s/$/\',/" textfile.txt > newfile.txt
Kubilay