Get a value from menu.

Hi,

I have a shell-script (in bash) wich read from a file this:

1 Telediario 1 2009012609000
2 Mira quien baila 2009012511000
3 No mas 2009012603000
.....
.....
12 Quiero ser tu 20090127113000
13 Al igual que 20090127130000
.....
.....

In the script I would like that the user input a number, and I have to find this number and get the second field and the third field.
for example, he puts 13 and I have to find "Al igual que" and "20090127130000".

could you help me?
Many thanks and sorry for my english!

Simply start with grep command with your input.

tab=$'\t'
read num
grep "^$num$tab" | cut -f2-
1 Like