Search Results

Search: Posts Made By: vgersh99
15,490
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
95,761
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)}'
95,761
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) }'
5,048
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
84,595
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=""
...
6,230
Posted By vgersh99
awk -F"," 'FNR==1{next}; ....'
awk -F"," 'FNR==1{next}; ....'
6,340
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...
4,937
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
3,428
Posted By vgersh99
how about: awk '{print $1,...
how about:

awk '{print $1, substr($1,length($1)-1)}' OFS='\t' myInputFile
4,231
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#.*#<!-- & -->#'
3,542
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')
...
5,257
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 >...
4,506
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 ...
4,506
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.
7,171
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
7,171
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,639
Posted By vgersh99
echo 'HiringManager_RHMC, DirectSupervisor_RHMC,...
echo 'HiringManager_RHMC, DirectSupervisor_RHMC, ProcessServerReadAccess_ST' | awk -F, '$1=$1' OFS='\n'
16,555
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#'
4,635
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...
2,969
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,653
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...
3,575
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.
3,881
Posted By vgersh99
YMMV: sed 's/.*=\(.*\)$/\1/' myFile awk...
YMMV:

sed 's/.*=\(.*\)$/\1/' myFile
awk -F= '{print $NF}' myFile
2,528
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
3,135
Posted By vgersh99
if you need to "fold" the lines at 60 char width,...
if you need to "fold" the lines at 60 char width, pipe the output to fold:
awk .... | fold -w 60
Showing results 1 to 25 of 500

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