Использовать «аргументы» модуля из bash-modules
Пример:
#!/bin/bash
. import.sh log arguments
NAME="world"
parse_arguments "-n|--name)NAME;S" -- "$@" || {
error "Cannot parse command line."
exit 1
}
info "Hello, $NAME!"
Попробуйте это:
public class T28Regex {
public static void main(String[] args) {
String[] strings = { "<someother string without *>:abc\t<some other string without \t>",
"<someother string without *>:abc,cde\t<some other string without \t>",
"<someother string without *>:abc,efg,cde\t<some other string without \t>",
"<someother string without *>:abc,cde\t<some other string without \t>" };
for (String s : strings) {
System.out.println(s.substring(0, s.indexOf(":")) + "|"
+ s.substring(s.indexOf(":") + 1, s.indexOf("\t", s.indexOf(":"))).replaceAll(",", "|")
+ s.substring(s.indexOf("\t", s.indexOf(":"))));
}
}
}