Search Results

Search: Posts Made By: dr.house
4,255
Posted By dr.house
#!/bin/bash
#!/bin/bash
1,464
Posted By dr.house
awk -F',' 'OFS="," {if ($6=="403") {print...
awk -F',' 'OFS="," {if ($6=="403") {print $1,$3,$10,$11,$12}}' data.file
1,724
Posted By dr.house
if [[ $FILE =~ IMG ]] # filename contains 'IMG',...
if [[ $FILE =~ IMG ]] # filename contains 'IMG', e.g. 'someIMGfile'
if [[ $FILE =~ ^IMG ]] # filename starts with 'IMG', e.g. 'IMGfile'
9,959
Posted By dr.house
[house@leonov] cat .ssh_hosts ...
[house@leonov] cat .ssh_hosts
mx.example1.com.au:2225
mx2.example2.com.au:2225
mx.example3.com.au:2225
mail.example4.com.au:2225
mail.example5.org.au:2225
mail.example6.com.au:2225...
1,929
Posted By dr.house
#!/bin/bash if [ $# -eq 0 ] then echo...
#!/bin/bash

if [ $# -eq 0 ]
then
echo "Automatic Mode Selected"
else
while getopts ai option 2>/dev/null
do
case "$option" in
a) echo "Automatic Mode Selected";;
i)...
2,772
Posted By dr.house
Maybe: [house@leonov] grep -A 2 '^ftp '...
Maybe:


[house@leonov] grep -A 2 '^ftp ' data.file
ftp SERVER
user UNAME PASS
send FILE_TO_BE_SENT
--
ftp SERVER1
user USER1 PASS1
send FILE_TO_BE_SENT_1
5,531
Posted By dr.house
[house@leonov] echo "basefilename_lengthone.sh" |...
[house@leonov] echo "basefilename_lengthone.sh" | awk -F "[_.]" '{print $2}'
lengthone
3,514
Posted By dr.house
How about: echo $a/$b | bc -l
How about:

echo $a/$b | bc -l
6,268
Posted By dr.house
One way: 1. Create a list of all files in...
One way:

1. Create a list of all files in question, e.g.:


ls -1 . > file.list
2. Split the list up in junk of 200 lines each:


LIST_001-200=$( cat file.list | sed -n '001,200p' )...
16,880
Posted By dr.house
No problem ;) YEAR=$( echo $FILE | awk -F...
No problem ;)


YEAR=$( echo $FILE | awk -F '-' '{print $2}' )
MONTH=$( echo $FILE | awk -F '-' '{print $3}' )
case $MONTH in
"01") MONTH='JAN' ;;
# etc. etc.
"04") MONTH='APR' ;;
#...
1,511
Posted By dr.house
Bash - String Manipulation...
Bash - String Manipulation (http://linuxgazette.net/18/bash.html)
1,511
Posted By dr.house
... sets ParamAddress to "ParamValue without...
... sets ParamAddress to "ParamValue without leading percent sign".



... compares both strings' contents (with "!=" meaning "not equal").
3,882
Posted By dr.house
The approach I've taken: Linux Professional...
The approach I've taken: Linux Professional Institute (http://www.lpi.org/) (European Branch (http://www.lpice.eu/))
7,465
Posted By dr.house
if [ $EXECHOST -ge 7132 ] && [ $EXECHOST -le 7151...
if [ $EXECHOST -ge 7132 ] && [ $EXECHOST -le 7151 ]
then
echo "This is a 32B machine, exiting..."
elif [ $EXECHOST -ge 7152] && [ $EXECHOST -le 7163 ]
then
NCPU=2
elif [ $EXECHOST -ge 7164...
13,065
Posted By dr.house
[house@leonov] cat in.file 1st line 2nd line ...
[house@leonov] cat in.file
1st line
2nd line
3rd line
[house@leonov] var=2; sed "${var}d" in.file
1st line
3rd line
2,178
Posted By dr.house
[/COLOR] if [ -n $( echo $a | grep '20100614' )...
[/COLOR]
if [ -n $( echo $a | grep '20100614' ) ]
then


if [ -n $( echo $a | grep '20100614' ) ] ; then
2,178
Posted By dr.house
if [ -n $( echo $a | grep '20100614' ) ] ...
if [ -n $( echo $a | grep '20100614' ) ]


if [[ "$a" =~ "20100614" ]]
5,276
Posted By dr.house
2,846
Posted By dr.house
echo "abc_ss_222_54.txt" | awk -F '.' '{print...
echo "abc_ss_222_54.txt" | awk -F '.' '{print $NF}'

ls -1 /tmp/vinay/act/files | grep -E 'fdr_c_us_cons_*.[txt|done]'
6,883
Posted By dr.house
In Ubuntu, sh points to dash (not bash)....
In Ubuntu, sh points to dash (not bash). Therefore: be explicit and either prepend your code with #!/bin/bash or call the script with bash ... ;)
1,253
Posted By dr.house
[house@leonov] var=$( date ); str=${var:4:12};...
[house@leonov] var=$( date ); str=${var:4:12}; echo "$str"
Jun 1 14:32
4,506
Posted By dr.house
Depending on the environment you're building,...
Depending on the environment you're building, resetting those user's umask (http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html) might prove helpful (or disastrous, as this...
2,075
Posted By dr.house
For one, quotes might prove helpful: ...
For one, quotes might prove helpful:


[house@leonov] used_ports=$( netstat -nat | cut -d: -f2 | cut -d' ' -f1 ); echo $used_ports
Active Proto 60224 2049 42344 40461 815 111 631 [...]
...
15,948
Posted By dr.house
if [ $( echo $pass | grep -o '[0-9]' | wc -l )...
if [ $( echo $pass | grep -o '[0-9]' | wc -l ) -ge 2 ]
8,378
Posted By dr.house
How about ... #!/bin/bash cat...
How about ...


#!/bin/bash

cat in.file | while read LINE
do
case $LINE in
"20") echo "Choice A" >> out.file ;;
"70") echo "Choice B" >> out.file ;;
"80") echo "Choice C" >>...
Showing results 1 to 25 of 27

 
All times are GMT -4. The time now is 02:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy