Warum nicht ?am punkt kann man nicht schneiden, an der endung nicht...
echo "/ordner/hosts.allow.blub" | awk -F '/' '{print $3}' | awk -F '.blub' '{print $1}'
a="/etc/hosts.allow.frm"; echo $a:r:t
echo /etc/hosts.allow.frm | sed 's#.*/##;s/\.[^.]*$//;'
^txt2regex$ is a Regular Expression "wizard", all written with bash2
builtins, that converts human sentences to regexes. With a simple
interface, you just answer to questions and build your own regex for a
large variety of programs, like awk, emacs, grep, perl, php, procmail,
python, sed and vim. There are more than 20 supported programs.
It's bash so download and run, no compilation needed.
Redet allows the user to construct regular expressions and test them against
input data by executing any of a variety of search programs, editors, and
programming languages that make use of regular expressions. When a suitable
regular expression has been constructed it may be saved to a file.
Redet stands for Regular Expression Development and Execution Tool. For each
program, a palette showing the available regular expression syntax is provided.
Selections from the palette may be copied to the regular expression window with
a mouse click. Users may add their own definitions to the palette via their
initialization file.
Redet also keeps a list of the regular expressions executed, from which entries
may be copied back into the regular expression under construction. The history
list is saved to a file and restored on startup, so it persists across
sessions. So long as the underlying program supports Unicode, redet allows
UTF-8 Unicode in both test data and regular expressions.
notoxp schrieb:Frage dich außerdem:
Was soll passieren, wenn der Dateiname mit Punkt beginnt, aber sonst keine weiteren Punkte im Namen hat?
Was soll passieren, wenn der Dateiname gar keinen Punkt im Namen hat?
echo /path/keinpunkt | perl -plne 's#.*/##;s/(.+)\.[^.]+$/$1/;'
echo /my/home/.profile | perl -plne 's#.*/##;s/(.+)\.[^.]+$/$1/;'
man basename