[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[help-recutils] Select records by number
From: |
F. |
Subject: |
[help-recutils] Select records by number |
Date: |
Thu, 5 Jan 2012 11:52:40 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi Jose !
first many thanks for recutils, it's great, it's excactly what I need
for my day to day usage, I love it !
Some feature thinking :
It'll be great if the recsel's num option (-n) can be more than a position
match:
examples:
select a range of records
recsel -n 1-10 path_to_my_file
multiple select records
recsel -n 1,5,8,123 path_to_my_file
select a range and specifics records
recsel -n 1-10,15,17,20-23 path_to_my_file
select a random records
recsel -r apath_to_my_file
select 5 random of records
recsel -r 5 apath_to_my_file
For the a random record I use this in my script:
---
#!/bin/bash
FILE="path_to_my_file.rec"
# How many records I have
MAX=$(recsel -c $FILE)
# Find a random number in my records range
NUM=$[ ( $RANDOM % $MAX + 1 ) ]
# recsel the random position
recsel -n $NUM $FILE
---
Sorry I cannot help to code, I'm only a user ...
Have a nice day.
F.