LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 07-28-2015, 04:06 AM   #1
alvinoo
LQ Newbie
 
Registered: Jun 2015
Posts: 3

Rep: Reputation: Disabled
Combine Multiple items from a checklist into one


Code:
$fileset='MAS0111.txt MAS0121.txt MAS0123.txt MAS0125.txt MAS0131.txt MAS0133.txt MAS0135.txt MAS0137.txt'
MAS0111.txt
Code:
==> 2.txt <==
---Section 2: Disable Unnecessary Services----
2.1
disabled
2.2
2.3
disabled
2.4
2.5.1
disabled
2.5.2
disabled
2.6
uninitialized
2.7
uninitialized
2.8.1
disabled
2.8.2
uninitialized
2.9
disabled
2.10
disabled
2.11.1
tcp_wrappers=TRUE
2.11.2
/etc/hosts.deny
2.11.3
/etc/hosts.allow
2.12
uninitialized
MAS0113.txt
Code:
==> 2.txt <==
---Section 2: Disable Unnecessary Services----
2.1
disabled
2.2
2.3
disabled
2.4
2.5.1
disabled
2.5.2
disabled
2.6
uninitialized
2.7
uninitialized
2.8.1
disabled
2.8.2
uninitialized
2.9
disabled
2.10
disabled
2.11.1
tcp_wrappers=TRUE
2.11.2
/etc/hosts.deny
2.11.3
/etc/hosts.allow
2.12
uninitialized
Given my checklist
Code:
2.1
2.2
2.3
How do I combine them such that:

Code:
<tr><td>2.1</td></td><td> MAS0111.txt:disabled <br/> MAS0113.txt:disabled </td>
I was able to do the above but it was for a single item only
Code:
awk '/2.2/ {P=0} P {print $0} FNR==1{printf("From file s:\n", FILENAME)} /1.1/ {P=1}'

Last edited by alvinoo; 07-28-2015 at 04:19 AM.
 
Old 07-28-2015, 08:43 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
I am not following For starters, which file did you use the awk script on?

You may want to explain more as currently I am not sure what we start with and what we are trying to end up with???
 
  


Reply



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
Can cloud be used to combine multiple Computers ? vzxen Linux - Server 13 11-16-2011 09:08 AM
combine multiple files into one file? baddah Linux - Newbie 10 09-06-2011 11:22 AM
Can you combine multiple PDFs into one? Randux Linux - Software 8 11-21-2007 02:00 PM
Help! Combine multiple .odt documents yuliang Linux - Desktop 1 01-18-2007 05:34 PM
Combine multiple WAN connections quentusrex Linux - Networking 3 01-07-2006 01:45 AM

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

All times are GMT -5. The time now is 08:22 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
Open Source Consulting | Domain Registration