Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-02-2018, 04:54 PM   #1
LQ Newbie
Registered: Mar 2018
Posts: 2

Rep: Reputation: Disabled
wildcard usage in find in the input and output assistance needed

I have a list of files (see below) I need to merge into separate files (merge1,merge2). merge1 would contain file1a_1 and file1a_2 merge2 would contain file2a_1, file2a_2

i.e. Files file1a_1 X1a_2 file1a_3 file1b_1 file1b_2 file1b_3

I tried find . -name "file_ -exec cat{} \; >> mergefile*
The shell script puts all the files into merge file and doesn't separate them out individually.

Any assistance would be appreciated
Old 03-02-2018, 06:04 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
It's easy with a loop and a counter, I can't think of an onliner solution with find

Are the files in same directory (not in subdirectories)?
Old 03-02-2018, 06:24 PM   #3
LQ Newbie
Registered: Mar 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
Figured out

Thanks everyone
Old 03-02-2018, 07:01 PM   #4
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,805
Blog Entries: 6

Rep: Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619Reputation: 2619
Welcome to LQ!

Congratulations, but it would be nice if you could share your solution with everyone else!

LQ is about more than simply finding answers, it is primarily about sharing knowledge with others. When you ask a question, the question and its answer become part of the growing body of shared knowledge - even if you answer it yourself!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get the output from the system command find as input into my daemon chessman1 Linux - Software 5 02-05-2016 12:46 PM
[SOLVED] stty: standard input: Input/output error [bash] DoME69 Programming 7 05-22-2015 01:14 AM
[SOLVED] cp command wildcard asterisk usage at the end of the destination path eNux eLin Linux - Newbie 27 10-20-2012 08:50 AM
Fix input/output error or find correct webcam driver for icecam2? agingcomputer Linux - Hardware 0 03-25-2010 09:06 AM
how to redirect the output of find command to input of egrep babu198649 Linux - Newbie 2 12-27-2007 04:50 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration