Search Results

Search: Posts Made By: SaCai
2,438
Posted By Akshay Hegde
$ cat file 0001 firstname1 lastname1 0002...
$ cat file
0001 firstname1 lastname1 0002 firstname2 lastname2 0003 firstname3 lastname3 0004 firstname4 lastname4

$ awk 'ORS = !(NR%3)? "\n" : FS ' RS=" " file
0001 firstname1 lastname1
0002...
1,044
Posted By complex.invoke
awk '{gsub(/>/,RS $1 FS)}1' infile
awk '{gsub(/>/,RS $1 FS)}1' infile
2,008
Posted By ygemici
# awk '{print $9"@"$7}' RS="\n\n\n" text ...
# awk '{print $9"@"$7}' RS="\n\n\n" text
xxxxxxxxx@11.11.11.11
yyyyyyyyyyyyy@11.11.11.22
zzzzzzzzzzz@11.11.11.33
14,177
Posted By Chubler_XL
Or#!/bin/bash b=(2 4 6) a=0 for i in...
Or#!/bin/bash
b=(2 4 6)
a=0
for i in ${b[@]}
do
narray[a++]=$((i*2))
done
echo ${narray[@]}
4,988
Posted By Scrutinizer
Can't you use unique sort? sort -ut, -k1,3...
Can't you use unique sort?
sort -ut, -k1,3 infile > outfile
1,860
Posted By balajesuri
And slightly tweaking agama's solution, here's...
And slightly tweaking agama's solution, here's without the use of temp file.

#! /bin/bash

i=0
while IFS=, read a b
do
names[$i]=${a#*=}
locs[$i]=$b
(( i++ ))
done < inputfile
10,306
Posted By radoulov
% cat infile 1333553619.647 1333553620.859 ...
% cat infile
1333553619.647
1333553620.859
% sed 'N; s/\(.*\)\n\(.*\)/\2-\1/' infile|bc
1.212
3,888
Posted By complex.invoke
#!/bin/bash getmd5sum() { ssh ${1}...
#!/bin/bash

getmd5sum()
{
ssh ${1} "md5sum ${file} | awk '{print $1}'"
}

for file in $(cat file_list); do
[[ "$(getmd5sum ipaddr1)" != "$(getmd5sum ipaddr2)" ]] && echo ${file} >>...
1,922
Posted By Scrutinizer
@rpf, if you use the suggestion with IFS, don't...
@rpf, if you use the suggestion with IFS, don't forget to put IFS back to its original value if you plan to do more stuff in the same shell, otherwise you will get unexpected results...
1,755
Posted By Scrutinizer
NOTE: these solutions are GNU only, nothing wrong...
NOTE: these solutions are GNU only, nothing wrong with that, but this will not work on every platform...
1,288
Posted By Scrutinizer
awk -F: '/^Record/{p=$1}/ID.*[^0]"$/{print p}'...
awk -F: '/^Record/{p=$1}/ID.*[^0]"$/{print p}' infile
*edit* this is incorrect
2,438
Posted By complex.invoke
$ cat infile <complexTypename="abc"> bklah...
$ cat infile
<complexTypename="abc">
bklah vlah
blah
blha blha blah
blha

</complexType >
<complexTypename="def">
bklah vlah
blah
blha blha blah
blha

</complexType >


$ cat...
2,165
Posted By ningy
top -n 1 | awk '{ if (NR==4) print int($5) }'
top -n 1 | awk '{ if (NR==4) print int($5) }'
9,376
Posted By complex.invoke
script_to_run: for n in $(find /data1 -name...
script_to_run:

for n in $(find /data1 -name 'ini*.ext'); do
echo cp $n "${n}.ext"
done

Invoking the script:

ssh user@machineB "bash -s" < script_to_run
1,087
Posted By Corona688
xargs -n 1 which < listfile
xargs -n 1 which < listfile
3,808
Posted By Ygor
Try...awk...
Try...awk '{a=b=0;for(i=1;i<=NF;i++)if($i+0==$i){a+=$i;b++};print a/b}' file1
3,564
Posted By balajesuri
#! /bin/bash while read x do y='' ...
#! /bin/bash
while read x
do
y=''
while [ ${#x} -gt 0 ]
do
y="${y}${x:0:2}:"; x=${x#??}
done
echo ${y%?}
done < inputfile


or

sed 's/\(..\)/\1:/g; s/:$//'...
1,288
Posted By Scrutinizer
Hi, try: awk 'NR%2{getline p<f}{print p OFS...
Hi, try:
awk 'NR%2{getline p<f}{print p OFS $1}' f=file1 file2
Showing results 1 to 18 of 18

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