How to list only the file names of the same type in the directory?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have two groups of files in the same directory *fmb
and *fmx
.
I want to learn how to print only the file name of fmb
files, file1.fmb, file2.fmb, file3.fmb
will be printed as file1, file2, file3
.
shell
add a comment |Â
up vote
0
down vote
favorite
I have two groups of files in the same directory *fmb
and *fmx
.
I want to learn how to print only the file name of fmb
files, file1.fmb, file2.fmb, file3.fmb
will be printed as file1, file2, file3
.
shell
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have two groups of files in the same directory *fmb
and *fmx
.
I want to learn how to print only the file name of fmb
files, file1.fmb, file2.fmb, file3.fmb
will be printed as file1, file2, file3
.
shell
I have two groups of files in the same directory *fmb
and *fmx
.
I want to learn how to print only the file name of fmb
files, file1.fmb, file2.fmb, file3.fmb
will be printed as file1, file2, file3
.
shell
shell
edited 19 mins ago
Rui F Ribeiro
37.3k1374118
37.3k1374118
asked Aug 13 '15 at 16:50
Haroldo Payares Salgado
32
32
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
for f in *.fmb; do printf '%sn' "$f%.*"; done
- Using pattern matching
*.fmb
to match all files end with.fmb
$f%.*
is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in$f
. Here we remove the extension part.fmb
.
I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
â Haroldo Payares Salgado
Dec 19 '17 at 21:49
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
for f in *.fmb; do printf '%sn' "$f%.*"; done
- Using pattern matching
*.fmb
to match all files end with.fmb
$f%.*
is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in$f
. Here we remove the extension part.fmb
.
I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
â Haroldo Payares Salgado
Dec 19 '17 at 21:49
add a comment |Â
up vote
2
down vote
accepted
for f in *.fmb; do printf '%sn' "$f%.*"; done
- Using pattern matching
*.fmb
to match all files end with.fmb
$f%.*
is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in$f
. Here we remove the extension part.fmb
.
I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
â Haroldo Payares Salgado
Dec 19 '17 at 21:49
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
for f in *.fmb; do printf '%sn' "$f%.*"; done
- Using pattern matching
*.fmb
to match all files end with.fmb
$f%.*
is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in$f
. Here we remove the extension part.fmb
.
for f in *.fmb; do printf '%sn' "$f%.*"; done
- Using pattern matching
*.fmb
to match all files end with.fmb
$f%.*
is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in$f
. Here we remove the extension part.fmb
.
answered Aug 13 '15 at 17:11
cuonglm
99.5k23194292
99.5k23194292
I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
â Haroldo Payares Salgado
Dec 19 '17 at 21:49
add a comment |Â
I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
â Haroldo Payares Salgado
Dec 19 '17 at 21:49
I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
â Haroldo Payares Salgado
Dec 19 '17 at 21:49
I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
â Haroldo Payares Salgado
Dec 19 '17 at 21:49
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f223045%2fhow-to-list-only-the-file-names-of-the-same-type-in-the-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password