LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 03-02-2018, 03:54 PM   #1
helpneededquick
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, 05:04 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,154

Rep: Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698
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, 05:24 PM   #3
helpneededquick
LQ Newbie
 
Registered: Mar 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
Figured out

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

Rep: Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525Reputation: 2525
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!
 
  


Reply


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 11:46 AM
[SOLVED] stty: standard input: Input/output error [bash] DoME69 Programming 7 05-22-2015 12:14 AM
[SOLVED] cp command wildcard asterisk usage at the end of the destination path eNux eLin Linux - Newbie 27 10-20-2012 07:50 AM
Fix input/output error or find correct webcam driver for icecam2? agingcomputer Linux - Hardware 0 03-25-2010 08:06 AM
how to redirect the output of find command to input of egrep babu198649 Linux - Newbie 2 12-27-2007 03:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:36 PM.

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