Search Results

Search: Posts Made By: vgersh99
12,742
Posted By vgersh99
ok, how about using find. To start with: ...
ok, how about using find. To start with:

find . \( -name '*.org' -o -name '*.texi' \) | xargs head
3,160
Posted By vgersh99
nawk -F. '{if (length($2)==6) s++}END{print s}' ...
nawk -F. '{if (length($2)==6) s++}END{print s}' myFile
68,025
Posted By vgersh99
How about: echo ${#text1} ${#text2} | awk...
How about:
echo ${#text1} ${#text2} | awk '$1*$2{a=b=$1;($1>$2)?a=$2:b=$2;print int(100/a*b)}'
68,025
Posted By vgersh99
a bit simpler - the order doesn't matter: ...
a bit simpler - the order doesn't matter:

echo ${#text1} ${#text2} | awk '{a=b=$1;($1>$2)?a=$2:b=$2;print (100/a*b) }'
4,150
Posted By vgersh99
how about to start with - you can enhance it to...
how about to start with - you can enhance it to match ONLY 6 or 8 chars (not 6 though 8 including 7) - left as an exercise:
grep -iE '^#[a-f0-9]{6,8}$' colours.txt
62,179
Posted By vgersh99
I don't follow... How creating a single script...
I don't follow... How creating a single script file will "create a lot more work" whether it gets run against one file/device or 50?
But if you insist:

#!/bin/ksh
awk '
{
idx=""
...
5,505
Posted By vgersh99
what have you done so far and where exactly are...
what have you done so far and where exactly are stuck?
have you searched for similar threads in these fora?
have you checked the 10 More Discussions You Might Find Interesting at the bottom of this...
5,381
Posted By vgersh99
awk -F"," 'FNR==1{next}; ....'
awk -F"," 'FNR==1{next}; ....'
4,531
Posted By vgersh99
how about: awk -F"'" 'FNR%2{f1=$0;next}...
how about:

awk -F"'" 'FNR%2{f1=$0;next} {for(i=2;i<=NF;i+=2) print f1, $i}' myFile
2,991
Posted By vgersh99
how about: awk '{print $1,...
how about:

awk '{print $1, substr($1,length($1)-1)}' OFS='\t' myInputFile
3,752
Posted By vgersh99
how about: echo '<Connector port="8009"...
how about:

echo '<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />' | sed '/<Connector port="8009".*\/>/ s#.*#<!-- & -->#'
2,745
Posted By vgersh99
how about a little bit more "interesting" - with...
how about a little bit more "interesting" - with the menu:

#!/bin/bash

menu=$(fdisk -l | awk '/Device Boot/ {for(i=2;i<=NF;i++) print substr($i,1, index($i, " ")-1)}' RS= FS='\n';echo 'quit')
...
4,633
Posted By vgersh99
how about (a bit verbose): awk -f san.awk...
how about (a bit verbose):
awk -f san.awk myInputFile, where san.awk is:

BEGIN {
FS=OFS="\t"
i1=1
i2=2
v=3
}
function abs(x) { return x < 0 ? -x : x }

FNR>1 {
idx=($i1 >...
3,975
Posted By vgersh99
or better yet /tmp/a.sh: #!/bin/bash while...
or better yet /tmp/a.sh:

#!/bin/bash
while IFS=, read f1 f2 junk
do
eval "$f2"
done < /tmp/a.txt


$ /tmp/a.sh
Filesystem Size Used Avail Use% Mounted on
C:/cygwin64 236G ...
3,975
Posted By vgersh99
either: #!/bin/bash a=$(df -kh|head -2) ...
either:

#!/bin/bash
a=$(df -kh|head -2)
echo "$a"

OR

#!/bin/bash
a='df -kh|head -2'
echo "$a"
eval "$a"

1st is preferred.
6,545
Posted By vgersh99
I'll leave it up to you to implement the shell...
I'll leave it up to you to implement the shell wrapper script, but...
for the 3 fields (5,8 and 12) to be modified, awk should be called as:
awk -v fld='5,8,12' -f hsquared.awk myFile.csv
6,545
Posted By vgersh99
a bit verbose and can be simplified - just...
a bit verbose and can be simplified - just following your description.

awk -v fld='5,8' -f hsquared.awk myFile.csv
where hsquared.awk is:
BEGIN {
FS=OFS=","
fld=(!fld)?"5":fld
...
2,304
Posted By vgersh99
echo 'HiringManager_RHMC, DirectSupervisor_RHMC,...
echo 'HiringManager_RHMC, DirectSupervisor_RHMC, ProcessServerReadAccess_ST' | awk -F, '$1=$1' OFS='\n'
15,416
Posted By vgersh99
how about for starters: echo...
how about for starters:
echo 'https://example.com/live-hls/bla:bob-sd-blabla/playlist.m3u8' | sed 's#.*:\([^-][^-]*\)-.*#\1#'
3,841
Posted By vgersh99
interesting puzzle! Are you saying one has to...
interesting puzzle!
Are you saying one has to "draw" an imaginary rectangle frame given the input coordinates?
I'm saying "imaginary", because the desired output coordinates are not in your input...
3,418
Posted By vgersh99
it could helpful if you provided a sample...
it could helpful if you provided a sample (simple) file and the description what column(s) need to be extracted.
Also having a sample input AND a desired output would be helpful as well.

Please...
2,554
Posted By vgersh99
RudiC/rdrtx1, the binning, the percentage and...
RudiC/rdrtx1,
the binning, the percentage and the totals are somewhat different from the OP's desired output in post #1.
Hence post #2 with the ask to elaborate.
3,349
Posted By vgersh99
be careful... some awk's don't have NR available...
be careful... some awk's don't have NR available in the END block. Just reassign NR to nr in your "main" block and use it in the END.
2,876
Posted By vgersh99
YMMV: sed 's/.*=\(.*\)$/\1/' myFile awk...
YMMV:

sed 's/.*=\(.*\)$/\1/' myFile
awk -F= '{print $NF}' myFile
2,379
Posted By vgersh99
just to add another "hint": look at the bottom of...
just to add another "hint": look at the bottom of this in the section titled: 10 More Discussions You Might Find Interesting
Showing results 1 to 25 of 500

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