Search Results

Search: Posts Made By: panyam
4,034
Posted By Chubler_XL
You could pretty up your script using whiptail: ...
You could pretty up your script using whiptail:

https://i.ibb.co/3Tc3S0m/Whiptail-Example.png

Here is an example script:

{
sleep 3
echo 25
sleep 3
echo 50
sleep 3
echo 75
sleep...
914
Posted By Yoda
Using shell built-ins:- while read line do ...
Using shell built-ins:-
while read line
do
for file in ${line//:/ }
do
print $file
done
done < data.txt

OR
tr ':' '\n' < data.txt
906
Posted By Yoda
Another lengthy approach: awk -F, ' ...
Another lengthy approach:
awk -F, '
BEGIN {
c = split ("ABCDEFGHIJKLMNOPQRSTUVWXYZ", U, "" )
c = split ("abcdefghijklmnopqrstuvwxyz", L, "" )
}
...
906
Posted By vidyadhar85
Sorry couldnt complete the script (Have to hit...
Sorry couldnt complete the script (Have to hit gym now ;)).. However I guess you can work on this :)


awk -F"," 'BEGIN{v="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z A"}{
split(v,A,"...
906
Posted By balajesuri
perl -F',' -lane 'grep { s/([a-yA-Y])/chr(ord($1)...
perl -F',' -lane 'grep { s/([a-yA-Y])/chr(ord($1) + 1)/ge; s/([zZ])/chr(ord($1) - 25)/ge; } ($F[12], $F[15]); print join(",",@F)' file
1,316
Posted By sam05121988
use epoch arithmetic
you can perform epoch arithmetic

1 day = 86400 secs
15 days = 1296000 secs


today's date
$ date
Fri Mar 22 06:18:17 EDT 2013

script to calculate date after 15 days


today=`date...
3,031
Posted By Don Cragun
When you have a pipeline, the standards allow...
When you have a pipeline, the standards allow (but do not require) the elements of the pipeline to be in different shell execution environments. If your system does put them in different shell...
2,525
Posted By RudiC
awk 'NR==FNR {MAS[$1]=$2" "$3; next} ...
awk 'NR==FNR {MAS[$1]=$2" "$3; next}
{for (i=1; i<=2; i++)
for (j in MAS) if (match($i, "^"j)) $i = MAS[j]
}
...
1,191
Posted By Yoda
That is useless use of ls...
That is useless use of ls (http://partmaps.org/era/unix/award.html#ls)

Using bash built-ins:
for file in *.{images,html}
do
cp -R "$file" /home/oracle/
done
4,316
Posted By jim mcnamara
The ending SQL is not seen. It needs to be in...
The ending SQL is not seen. It needs to be in the leftmost column. Or structured differently Your here doc need to be one of these:

sqlplus -s user/pass <<-SQL

...
989
Posted By Scrutinizer
Another ( awkish :) ) awk: awk 'NF &&...
Another ( awkish :) ) awk:
awk 'NF && ORS=++i%7?FS:RS' file
989
Posted By Scrutinizer
How about: xargs -n7 < file
How about:
xargs -n7 < file
2,092
Posted By Scrutinizer
Hi, the first one deletes the second field only...
Hi, the first one deletes the second field only if it consists of one character... It replace the first field and a colon + a character and a colon with the first field (that was captured with \( .....
717
Posted By summer_cherry
awk, perl, python
awk
gawk -F"[|]" '{
if(NR==FNR){
_[$1]=sprintf("%s,%s",_[$1],$2)
}
else{
tmp=_[$1]
n=split(tmp,arr,",")
for(i=2;i<=n;i++){
print $0"|"arr[i]
}
}
}
' b a

perl
open my...
1,122
Posted By Corona688
I do. find evaluates * for -name and -path. It...
I do. find evaluates * for -name and -path. It wouldn't make sense to put the * outside quotes -- how could the shell expand filenames find hasn't found yet?
717
Posted By pamu
awk -F "|" 'NR==FNR{X[$1,++Y[$1]]=$2;next} ...
awk -F "|" 'NR==FNR{X[$1,++Y[$1]]=$2;next}
{for(i=1;i<=Y[$1];i++){print $1,$2,X[$1,i]}}' OFS="|" file2 file1
717
Posted By PikK45
this should help you join -t"|" file1...
this should help you

join -t"|" file1 file2
1,785
Posted By Chubler_XL
You could also use grep: $ grep -oE "xyz:...
You could also use grep:

$ grep -oE "xyz: \[[^]]+\]" file
xyz: [1234]
xyz: [12312]
2,453
Posted By yazu
Hi! The simplest way is to read the whole...
Hi!

The simplest way is to read the whole file in array, split it to four parts, process then and write the result in the output file. Because it's really simple and quick then perhaps you should...
1,790
Posted By yazu
echo `cat INPUTFILE` | sed 's/>...
echo `cat INPUTFILE` | sed 's/> </></g'
2,271
Posted By Corona688
So make a new account -- that's what they're...
So make a new account -- that's what they're there for. Grant read-write permissions to the new user, execute-only permissions to the application group, and nothing else at all to anything. ...
9,201
Posted By alister
It means that if you assign to a field beyond...
It means that if you assign to a field beyond $NF, the necessary fields will be created, NF will be recomputed, and $0 will be rebuilt.

For example (with FS==OFS==","):
$0 == "a,b,c,d,e,f"
$NF...
Showing results 1 to 22 of 22

 

Featured Tech Videos

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