[Users] Q. re: tags (tagging locally-saved messages for use outside Claws)
Victoria Stuart (gmail)
victoria.a.stuart at gmail.com
Fri Mar 24 03:28:40 CET 2017
Update: I've solved it, programmatically:
PROBLEM: tag a file, at the top of the file, with the base name of the parent directory.
SOLUTION 1 -- non-empty files:
$ bn=${PWD##*/} ## bn: basename
$ sed -i '1s/^/'"$bn"'\n/' <filename>
SOLUTION 2a -- empty files:
## sed fails on empty files; solution:
$ printf "${PWD##*/}\n" >> <filename>
SOLUTION 2b -- recurse over directory:
$ for file in *; do printf "${PWD##*/}\n" >> $file; done
Posted at: http://stackoverflow.com/questions/9533679/how-to-insert-a-text-at-the-beginning-of-a-file/42989868#42989868
Gist: https://gist.github.com/victoriastuart/7457b2727d21a37b7a79eb9a957b988d
More information about the Users
mailing list