New answers tagged cut
1
vote
Extract substring between n and m delimiter
With zsh:
print -rC1 -- input/*.mcool(N:t:r:r:r:r)
(where the :t modifier gets you the tail, and :r the root (removes an extension) of the file like in csh or vim).
Or:
set -o histsubstpattern
print -...
0
votes
Extract substring between n and m delimiter
If you know that it is the third /and fourth ., you may as well use awk and define fields according to / and . as delimiters:
awk -F'[./]' '{print $7}'
0
votes
Extract substring between n and m delimiter
If all input looks like
./../input/A001C007.hg38.nodups.pairs.mcool
then the probably easiest approach is:
start cmd:> sed -e 's+^./../input/++' -e 's/\..*$//' input
A001C007
A001C008
If you want ...
3
votes
Extract substring between n and m delimiter
for pathname in input/*.mcool; do
basename "${pathname%%.*}"
done
This iterates over all names in the directory input that end in .mcool. For each pathname in $pathname, the pathname ...
Top 50 recent answers are included
Related Tags
cut × 431awk × 148
sed × 110
text-processing × 106
grep × 94
bash × 64
shell-script × 54
linux × 47
shell × 36
command-line × 22
sort × 16
string × 13
columns × 13
scripting × 11
uniq × 11
csv × 10
paste × 10
files × 9
find × 9
regular-expression × 9
text-formatting × 9
echo × 9
pipe × 8
tail × 8
perl × 7