Login or Register to Ask a Question and Join Our Community

Search Results

Search: Posts Made By: itkamaraj
3,446
Posted By itkamaraj
Hi, why dont you try in for loop. with some sleep...
Hi, why dont you try in for loop. with some sleep time enabled. change the SOURCE_DIR and DESTINATION_DIR values according to your source and destination folder

#!/bin/bash...
61,108
Posted By itkamaraj
Another solution in awk. Just empty the first...
Another solution in awk. Just empty the first field and print the line

awk '{$1=""}1' input.txt
2,346
Posted By itkamaraj
Not tested.. this script will check the...
Not tested..

this script will check the directory size is in GB and if its more than 50GB then it get the corresponding userid in for loop. implement your notification method in for loop
...
3,722
Posted By itkamaraj
why dont you just change Mr. to Mr# using sed...
why dont you just change Mr. to Mr# using sed command then pass the file to awk command. later.. change Mr# to Mr.

can you give the sample input file and expected output file

sed 's/Mr\./Mr#/g'...
642
Posted By itkamaraj
If is not loop. Its conditional statement. I...
If is not loop. Its conditional statement.

I guess, APPEND is having string.

please try this

#!/bin/bash

echo -n "Enter the String : "
read APPEND
LENGTH=${#APPEND}
if [[ -z...
923
Posted By itkamaraj
ha.. your script is big and not in readable...
ha.. your script is big and not in readable format.. sorry for that...

can you post sample input contents and the logic you are using and the expected output

how many files inside your <path> ?...
1,601
Posted By itkamaraj
paste file1 file2 $ awk...
paste file1 file2

$ awk 'NR==FNR{a[NR]=$0;next}{print a[FNR],$0}' file1 file2
1 text1
2 text2
3 text3
4 text4
Forum: What is on Your Mind? 12-26-2016
1,974
Posted By itkamaraj
Congrats Rudic ;)
Congrats Rudic ;)
1,224
Posted By itkamaraj
$ awk -F\| '$1~/^[0-9]/{printf("\n%s...
$ awk -F\| '$1~/^[0-9]/{printf("\n%s ",$0);next}{printf("%s",$0)}END{print "\n"}' input.txt

113321|107|E|1|828|20|4032832|EL POETA|VILLALOBOS MIJARES PABLO NEPTALI RICARDO...
1,383
Posted By itkamaraj
awk '($0 ~ /ERROR/ && $0!~/IGNORE/){Q=$0;next}...
awk '($0 ~ /ERROR/ && $0!~/IGNORE/){Q=$0;next} ($0 ~ /ID/){print Q ORS "There is Error for ID " $NF}' test.txt
1,383
Posted By itkamaraj
change $1 to $0 awk '($1 ~...
change $1 to $0

awk '($1 ~ /ERROR/){Q=$0;next} ($0 ~ /ID/){print Q ORS "There is Error for ID " $NF}' Input_file
606
Posted By itkamaraj
its wildcard refer more details from this...
its wildcard

refer more details from this link (http://www.robelle.com/smugbook/wildcard.html)

? any single character, except a leading dot
* zero or more characters, except a leading dot
[...
1,383
Posted By itkamaraj
try with this.. awk '/ERROR/{err=$0}err &&...
try with this..

awk '/ERROR/{err=$0}err && /ID/{printf("%s\nThere is Error for %s : %s\n",err,$(NF-2),$NF);err="";}' input.txt
1,383
Posted By itkamaraj
awk '/ERROR/{err=$0}err && /ID/{printf("%s\nThere...
awk '/ERROR/{err=$0}err && /ID/{printf("%s\nThere is Error for %s\n",err,$0);err="";}' input.txt
1,298
Posted By itkamaraj
try this... awk...
try this...

awk 'NF<2{$0="NAME;"$0"\tfailed"}1' incomplete_case_list
aname val
NAME;r'(1,) 3.28584
NAME;r'(2,) failed
NAME;r'(3,) 6.13003
NAME;r'(4,) 4.18037
NAME;r'(5,) ...
582
Posted By itkamaraj
perl -lane 'print ($F[1]+$F[2])*$F[3]' inputfile
perl -lane 'print ($F[1]+$F[2])*$F[3]' inputfile
858
Posted By itkamaraj
how about this ? same code of @Rudic.. but...
how about this ?

same code of @Rudic.. but just adding exit to read only the first line on all files

for file in *.txt; do awk -F'|' '$1=="\"HD\"" {gsub(/"/,"",$3); print FILENAME, $3;exit}'...
2,414
Posted By itkamaraj
try this... awk -F,...
try this...

awk -F, '{split($2,Arr,".")}length(Arr[2])>2' test
4,779
Posted By itkamaraj
array length can be retrieved as ${#array[@]} ...
array length can be retrieved as ${#array[@]}

for (( index=${#array[@]}-1 ; index>=0 ; index-- )) ; do
echo "${array[index]}"
done
1,749
Posted By itkamaraj
$ cat test.txt 'ABC ' 'CDE ' 'FGHIJKL ' ...
$ cat test.txt
'ABC '
'CDE '
'FGHIJKL '
'MN '
'TEST HELLO '
' HI TEST TXT '


$ sed "s, *'$,',g" test.txt
'ABC'
'CDE'
'FGHIJKL'
'MN'
'TEST HELLO'
' HI TEST TXT'
963
Posted By itkamaraj
try this ps -ef | awk...
try this

ps -ef | awk '/[c]hannel=5182/{for(i=1;i<=NF;i++)if($i~/supports/)print $i}'
5,797
Posted By itkamaraj
Gnu grep has -C option. bash-3.2$ cat t.txt...
Gnu grep has -C option.

bash-3.2$ cat t.txt
Service name: Bot_Serv1
Service is disabled
Preferred instances: botqa2,botqa3

Service name: Bot_Serv2
Service is enabled
Preferred instances:...
3,076
Posted By itkamaraj
#!/bin/bash INPUT_FILE=input.txt awk...
#!/bin/bash

INPUT_FILE=input.txt

awk 'BEGIN{
E_Len=split("7,9,10,11,12,13",E_Arr,",");
}
{
if($3 == "E")
{
for(i=1;i<=E_Len;i++)
{
col_num=E_Arr[i];
sum+=$col_num;
}...
3,492
Posted By itkamaraj
#!/bin/bash list="1:11:00 0:13:03 2:06:45" ...
#!/bin/bash

list="1:11:00 0:13:03 2:06:45"

h=0
m=0
s=0
for x in ${list}
do
echo ${x}
h=$(( h + ${x%%:*} ))
Min=$(echo ${x%:*} | cut -d: -f2)
m=$(( m +...
1,118
Posted By itkamaraj
echo "${TOTALRunning}" | awk -F"[. ]"...
echo "${TOTALRunning}" | awk -F"[. ]" -vP="${PROCSEARCH}" /$0~P/ {printf("%s|",$2)}END{print "\n"}'
Showing results 1 to 25 of 500

 

Featured Tech Videos