Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-23 Thread Albretch Mueller
Thank you very much, Greg! Since ".description" is constant (an extension used by youtube) I chose to go: ydx=".description" ydxL=${#ydx} ... yut=${yl:-${ydxL}} ... where yl is the line read in in the way you suggested. lbrtchx

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-23 Thread Andy Smith
Hello, On Mon, Oct 23, 2023 at 01:32:08AM +, Albretch Mueller wrote: > On 10/22/23, Andy Smith wrote: > > So you might consider telling us what you will do next with the > > suffix of each line. > > Now you have gone into mind reading mode. I've gone into "avoid the need for mind reading"

Re: Shell-script variable name case [WAS: Re: can you parse and "tail" at once? (and if you can't why not?)]

2023-10-23 Thread Eduardo M KALINOWSKI
On 23/10/2023 10:56, David wrote: Hi, for your info, this convention is specified by POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html Which says: Environment variable names used by the utilities in the Shell and Utilities volume of POSIX.1-2017 consist

Shell-script variable name case [WAS: Re: can you parse and "tail" at once? (and if you can't why not?)]

2023-10-23 Thread David
On Mon, 23 Oct 2023 at 13:25, Eduardo M KALINOWSKI wrote: > On 22/10/2023 23:13, Greg Wooledge wrote: > > 2) All-caps variable name IFL. All-caps variable names are reserved, > >by convention, for environment variables (e.g. PATH) and special > >shell variables (e.g. IFS). > While I

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-23 Thread Eduardo M KALINOWSKI
On 22/10/2023 23:13, Greg Wooledge wrote: 2) All-caps variable name IFL. All-caps variable names are reserved, by convention, for environment variables (e.g. PATH) and special shell variables (e.g. IFS). While I don't disagree with the suggestion of using lower case for variables

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-23 Thread Greg Wooledge
On Mon, Oct 23, 2023 at 01:21:43PM +0530, Pankaj Jangid wrote: > Another way to do it is, > > cat "${IFL}"| cut -d "/" -f7-|sed 's/.description//' > > because you already know the prefix, you can count the fields. So "-f7-" > i.e. 7 onwards. Then use sed to remove the extension. Whoops! I

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-23 Thread Pankaj Jangid
Albretch Mueller writes: > After generating a file with lines of text, I have to: > 1) parse some of those lines based on a pattern I know (no regex > necessary, just a FS path) > 2) once parsed from those lines I need the last n characters only > I am trying to use a one liner like: > cat

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread tomas
On Sun, Oct 22, 2023 at 10:13:26PM -0400, Greg Wooledge wrote: [...] Good points all over -- I envy your clarity. To drive home Greg's point about naming conventions a bit more: bash (in general, shells) have very little protection for mis-naming variables (you don' have to declare them, they

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Patrick Wiseman
On Sun, Oct 22, 2023, 10:39 PM Albretch Mueller wrote: > OK, Greg's suggestion once again "made my day". > I know at some point I will have to code everything in some > programming language, but for now I will just get things done as > quickly as possible. > Also, Greg, please, I would like

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Greg Wooledge
On Mon, Oct 23, 2023 at 01:32:08AM +, Albretch Mueller wrote: > On 10/22/23, Andy Smith wrote: > > Most of the points Greg makes to you are matters of correctness, not > > matters of taste. > > that you called "matters of correctness" may be "visual things" to > other people. this is

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Albretch Mueller
On 10/22/23, Andy Smith wrote: > So you might consider telling us what you will do next with the > suffix of each line. Now you have gone into mind reading mode. On 10/22/23, Andy Smith wrote: > Most of the points Greg makes to you are matters of correctness, not > matters of taste. that

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread gene heskett
On 10/22/23 17:11, Andy Smith wrote: Hello, On Sun, Oct 22, 2023 at 08:50:55PM +, Albretch Mueller wrote: Greg, please, I would like for you to understand that it is not my intention to upset you about what you find visually upsetting. We have talked about that before. Most of the points

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Andy Smith
Hello, On Sun, Oct 22, 2023 at 08:50:55PM +, Albretch Mueller wrote: > Greg, please, I would like for you to understand that it is not my > intention to upset you about what you find visually upsetting. We > have talked about that before. Most of the points Greg makes to you are matters of

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Albretch Mueller
OK, Greg's suggestion once again "made my day". I know at some point I will have to code everything in some programming language, but for now I will just get things done as quickly as possible. Also, Greg, please, I would like for you to understand that it is not my intention to upset you about

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Andy Smith
Hello, On Sun, Oct 22, 2023 at 04:33:12PM +, Albretch Mueller wrote: > After generating a file with lines of text, I have to: > 1) parse some of those lines based on a pattern I know (no regex > necessary, just a FS path) > 2) once parsed from those lines I need the last n characters only

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Roberto C . Sánchez
On Sun, Oct 22, 2023 at 04:33:12PM +, Albretch Mueller wrote: > After generating a file with lines of text, I have to: > 1) parse some of those lines based on a pattern I know (no regex > necessary, just a FS path) > 2) once parsed from those lines I need the last n characters only > I am

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Greg Wooledge
On Sun, Oct 22, 2023 at 04:33:12PM +, Albretch Mueller wrote: > I am trying to use a one liner like: > cat "${IFL}" | grep "${DESC_DIR}" | tail -c+$_DESC_DIR > but this one liner repeats the output and the tail Brevity is not the measure of goodness. When you write a shell script, it's

Re: can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Charles Curley
On Sun, 22 Oct 2023 16:33:12 + Albretch Mueller wrote: > After generating a file with lines of text, I have to: > 1) parse some of those lines based on a pattern I know (no regex > necessary, just a FS path) > 2) once parsed from those lines I need the last n characters only > I am trying

can you parse and "tail" at once? (and if you can't why not?)

2023-10-22 Thread Albretch Mueller
After generating a file with lines of text, I have to: 1) parse some of those lines based on a pattern I know (no regex necessary, just a FS path) 2) once parsed from those lines I need the last n characters only I am trying to use a one liner like: cat "${IFL}" | grep "${DESC_DIR}" | tail