Search Results

Search: Posts Made By: max_hammer
1,571
Posted By max_hammer
awk command not replacing in first line
As per requirement if column 2 is NULL then 'N' ELSE 'Y'.

I have written below awk code. But it is not replacing values for first line. :confused:


cat temp.txt
1|abc|3
1||4
1|11|c ...
1,380
Posted By max_hammer
ps aux | grep -i "hald" Will print the grep...
ps aux | grep -i "hald"

Will print the grep in output.

-v : print all lines that don't match the pattern

try man grep
1,353
Posted By max_hammer
Try searching ...
Try searching


https://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html
14,367
Posted By max_hammer
ps -ef|grep "rams.e $PORT"|grep -v grep | awk...
ps -ef|grep "rams.e $PORT"|grep -v grep | awk '{print $2}'
Forum: Linux 06-29-2012
3,163
Posted By max_hammer
sar | awk 'NR>2{$2=$3=""}1' | column...
sar | awk 'NR>2{$2=$3=""}1' | column -t
6,124
Posted By max_hammer
#!/bin/ksh record_count_1=`wc -l < file1` ...
#!/bin/ksh
record_count_1=`wc -l < file1`
record_count_2=`wc -l < file2`

((result= ${record_count_1} / ${record_count_2} ))
3,276
Posted By max_hammer
cd /root/admin/files ls -1 |head -1
cd /root/admin/files
ls -1 |head -1
3,671
Posted By max_hammer
Its working for me you can try this ...
Its working for me

you can try this


$ echo "hello:myde:temp:stiker" | cut -d: -f2,4 | tr ':' '-'
myde-stiker
3,276
Posted By max_hammer
try this ls -ltr...
try this


ls -ltr /root/admin/files/file* | head -1 | awk -F "/" '{print $NF}'


here i have set the field seprator as "/" awk -F "/" and $NF means last field
3,671
Posted By max_hammer
Edit : $ echo "hello:myde:temp:stiker" |...
Edit :

$ echo "hello:myde:temp:stiker" | cut -d: --output-delimiter='-' -f2,4
myde-stiker


Sorry for the first code.
Deleted it :)
1,437
Posted By max_hammer
sed -n '/qwertykeyboard white/,/qwertykeyboard ...
sed -n '/qwertykeyboard white/,/qwertykeyboard black/p' < inputfile | sed '1d'| sed '$d' > file1
sed '/qwertykeyboard white/,/qwertykeyboard black/d' < inputfile > file2



let me...
3,276
Posted By max_hammer
ls -ltr /root/admin/files/file* | head -1 | awk...
ls -ltr /root/admin/files/file* | head -1 | awk '{print $NF}'
5,033
Posted By max_hammer
Thanks balajesuri for correction and information....
Thanks balajesuri for correction and information.

I am using ksh and single bracket works fine for ksh. :)
2,689
Posted By max_hammer
Why dont you try print n number of lines...
Why dont you try

print n number of lines after the line containing ERROR


print n number of lines before the line containing ERROR
5,033
Posted By max_hammer
Which bash version you are using there was...
Which bash version you are using

there was a change between 3.1 and 3.2

if its 3.2 try


if [[ "${ch}" =~ [0-9] ]]


With out double quotes on regex.

Thanks Balasuri for...
5,033
Posted By max_hammer
You can use regular expression match if [...
You can use regular expression match

if [ "${ch}" =~ "[0-9]" ]
5,033
Posted By max_hammer
if [ "${ch}" -eq "3" -o "${ch}" -eq "4" ] ...
if [ "${ch}" -eq "3" -o "${ch}" -eq "4" ]


Should be


if [ "${ch}" = "3" -o "${ch}" = "4" ]

OR

if [ ${ch} -eq 3 -o ${ch} -eq 4 ]


= for comparing string
-eq for numbers
3,976
Posted By max_hammer
sed 's#^"##g;s# "#\^_#g;s#" #\^_#g'
sed 's#^"##g;s# "#\^_#g;s#" #\^_#g'
1,111
Posted By max_hammer
HOME="Your name" export HOME ----------...
HOME="Your name" export HOME

---------- Post updated at 05:42 AM ---------- Previous update was at 05:40 AM ----------


echo "<p><input type=\"text\" name=\"name\" value=\"${HOME}\" /></p>"
1,879
Posted By max_hammer
#! /bin/ksh set -A array1 11 12 13 14 15 set...
#! /bin/ksh
set -A array1 11 12 13 14 15
set -A array2 abc def ghi ijk lmn
i=0
while [ $i -ne ${#array1
} ]
do
echo " Hello ${array1[i]} ${array2[i]}"
(( i = i + 1 ))
done

...
8,830
Posted By max_hammer
find . -type f -printf "%AY %p\n" | grep...
find . -type f -printf "%AY %p\n" | grep "^2010"
1,142
Posted By max_hammer
ls -ltr /home/backup | tail -1 will give...
ls -ltr /home/backup | tail -1

will give you the latest file in your back up dir

why is error when you trying to pass as parameter ?
3,889
Posted By max_hammer
This may help :) ...
This may help :)

https://www.unix.com/unix-dummies-questions-answers/156460-difference-between-executing-llike-myscript-ksh-myscript-ksh.html
1,344
Posted By max_hammer
awk '{print $1 , $2 ,$3 }' < infile
awk '{print $1 , $2 ,$3 }' < infile
2,214
Posted By max_hammer
echo "this is a test line." | sed...
echo "this is a test line." | sed 's/[a-z][a-z]*/"&",/g'
"this", "is", "a", "test", "line",.
Showing results 1 to 25 of 56

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