Tuesday, January 20, 2015

Re: [LINUX_Newbies] Help with script and regex.

 

On 19/01/15 05:20 PM, J dreadpiratejeff@gmail.com [LINUX_Newbies] wrote:
 

Snipped everything but part of Cameron's reply because that's what I'm
really commenting about (though the comment is directed at the OP, not
Cameron)

On Mon, Jan 19, 2015 at 5:54 PM, Cameron Simpson cs@zip.com.au
[LINUX_Newbies] <LINUX_Newbies@yahoogroups.com> wrote:

> {2009}«{12}«{04}«{PHOTOS}«{Pictures}

I'm kinda curious about why the need for {} and << in a file name and
path? Given that in BASH and DASH, at least, both are special shell
characters, right?

Because to type that out on a shell (which you'd need to do in most
scripts, right? maybe not in python, perhaps, but anything that is
done in shell) you'd need to escape all that, and end up looking like
this when typed in manually:

# \{2009\}|\<\<\{12\}\<\<\{04\}\<\<\{PHOTOS\}\<\<\{Pictures\}

Even in sed or awk, I believe you'd need to escape all that, I think.
But I say that without trying it out, so YMMV it may be easier than
what I'm imagining.

Personally, my photos are all categorized more descriptively (and more
shell friendly for times when I need to use a shell script on one or
more directories and filenames:

/Photography/2014/2014-04-25_Some_Event/raw/2014-04-25_Some_Event-001.raw
/Photography//2014/2014-04-25_Some_Event/processed/2014-04-25_Some_Event-001.jpg

Anyway, point is, if you want to use shell scripts on things, it
really pays to not use special shell constructs in the naming
convention.

But that's just my opinion...

I can easily replace the brackets and double less than characters. I only used them to be sure I wasn't duplicating a character already in a directory name. However, I'm 99.9% sure there isn't, so I can replace them with something else. Any suggestions what to use that wouldn't need to be escaped in a script?


I am going to sort them by YYYY-MM-DDD when I get finished, but I have a few intermediary steps to do first ...

Emil

__._,_.___

Posted by: Emil Payne <ehspayne@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (10)
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.

.

__,_._,___

No comments:

Post a Comment