The time now is Wed 20 Jan 2021, 21:26
All times are UTC - 4 |
Page 3 of 3 [33 Posts] |
Goto page: Previous 1, 2, 3 |
Author |
Message |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Mon 27 Aug 2012, 16:32 Post subject:
|
|
L18L wrote: | Why 3 columns? |
Column 2 is not always basename.
Preferable it collects information from meta tags or m3u-file.
_________________ Stardust resources
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 6629 Location: Valåmoen, Norway
|
Posted: Mon 27 Aug 2012, 17:01 Post subject:
Re: Awk: Count numbers in list |
|
L18L wrote: | zigbert wrote: | Also, what we want is to define a alternative max value to find timestamps in a specific period. - Like february 2012. Let's say that is $4. |
Where is $1 ? $1 is for pMusic internal redirection
Here is a solution using $1 and $2 timestamp from and -to
Quote: | #!/bin/ash
#additional output filename only=basename
#TIMESTAMP from to
#
LANG=C
#
FIND_FROM=$1 #timestamp
FIND_TO=$2
awk -F, -v TS1=$FIND_FROM -v TS2=$FIND_TO '{
split($1, a, "|"); $1=a[2] # fix first entry
max=NF; min=0;
while (max-min > 1) {
i=int( (max+min)/2 )
if (TS1 >= $i) min = i
else max = i
}
from=NF-min
max=NF; min=0;
while (max-min > 1) {
i=int( (max+min)/2 )
if (TS2 >= $i) min = i
else max = i
}
to=NF-min
variable 'to' is never 0, even if zero hits
num=split (a[1], b , "/")
print a[1], b[num], from-to
}' database.txt
|
|
Else, I find this excellent!!!!!
_________________ Stardust resources
|
Back to top
|
|
 |
L18L

Joined: 19 Jun 2010 Posts: 3493 Location: www.eussenheim.de/
|
Posted: Tue 28 Aug 2012, 08:50 Post subject:
Re: Awk: Count numbers in list |
|
zigbert wrote: | Else, I find this excellent!!!!! | And our thanks go to: jamesbond
|
Back to top
|
|
 |
|
Page 3 of 3 [33 Posts] |
Goto page: Previous 1, 2, 3 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
[ Time: 0.0963s ][ Queries: 11 (0.0429s) ][ GZIP on ] |