Sponsored Content
Full Discussion: Bring two files together
Top Forums Shell Programming and Scripting Bring two files together Post 302960135 by GDC on Wednesday 11th of November 2015 02:32:01 AM
Old 11-11-2015
Dear Yoda, dear Aia, dear RudiC,

thank you all for helping me to find three perfect solutions for my problem. @Aia, sorry if my description of the problem was not so clear.

Here the three solutions that worked for me:

Code:
time awk 'FNR==NR {h["+" $1]=$2;next} $1 in h {print $0, h[$1]; getline; print}' text.txt header.txt > outA.tmp

real	0m20.552s
user	0m17.823s
sys	0m2.697s

Code:
time awk '
        NR == FNR {
                i = substr($0,2);
                getline;
                A[i] = $0
                next
        }
        $1 in A {
                print "+" $0 RS A[$1]
        }
' text.txt head.txt > outB.tmp

real	0m22.600s
user	0m19.482s
sys	0m3.078s

Code:
time awk 'FNR==NR {h[$1]=$2;next} $1 in h {print "+" $1, h[$1];print $2}' header.txt RS="+" text.txt > outC.tmp

real	1m29.579s
user	1m25.451s
sys	0m3.584s

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Bring back removed files

Dear People I have removed some of my files and directories( by using rm and rmdir commands) by mistake. I wish to bring them back. How is it possible?( I am using solaris 2.6) best regards Reza Nazarian:( (2 Replies)
Discussion started by: Reza Nazarian
2 Replies

2. IP Networking

unable to bring up any interface

I have Linux 7.1 setup on a Dell and am unable to bring up any interfaces. Both the lo and eth0 fail upon boot up and I get a insmod error possibly due to bad irq or IO setting. If I disable eth0 upon boot, then lo works fine, but offcourse I get the "delaying initialization" upon boot for eth0... (1 Reply)
Discussion started by: alam
1 Replies

3. Solaris

bring up GUI on solaris

I have just installed solaris 10 on a sever .would appreciate if somebody can help me bringing up the GUI(basically i want to launch the browser) (1 Reply)
Discussion started by: Anant
1 Replies

4. UNIX for Dummies Questions & Answers

Unable to bring up Sun OS

The last thing I did was set REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE. Then rebooted server. Since that time I have not been able to login. During bootup it can't find root and generates alot of errors. Does anybody know of a default login and password that will allow me to log in and rebuild the... (2 Replies)
Discussion started by: mayewil
2 Replies

5. Solaris

Not able to bring up the server

Hi All, I have a iplanet server running on solaris , i'm not able to start it using the start Its giving following error root@bld00: /usr/iplanet/servers6.1sp8/https-MLL-8.3dev # ./start Sun ONE Web Server 6.1SP8 B06/13/2007 23:15 info: CORE5076: Using from info: WEB0100: Loading web... (2 Replies)
Discussion started by: renjithrnath
2 Replies

6. Red Hat

Cannot bring up Firefox

I have installed firefox and it previously worked before I installed the oracle software on my machine. Now when I click on the icon to bring up the browser it fails. I tried to do it from the command line and this is what I get: $ firefox Cannot find mozilla runtime directory. Exiting ... (1 Reply)
Discussion started by: jxh461
1 Replies

7. UNIX for Dummies Questions & Answers

bring up/down numerous interfaces

On a Solaris 9 system I had something happen to some of my interfaces; for some reason half of them went down. Since I have over 30 different Virtual IP's (or logical IP's) up on ce10 I don't want to take the time to find out which ones are up and which ones are down or even run the addif command... (2 Replies)
Discussion started by: snoman1
2 Replies

8. HP-UX

Adding Storage, do I need to bring the DB down?

Hi Guys, Do I need to bring the DB down? masd023x:: uname -r B.11.11 Thanks! Where can I find this type of information? JC (3 Replies)
Discussion started by: 300zxmuro
3 Replies

9. Shell Programming and Scripting

Bring prompt from a different process

Hi, while running a program one of the command is creating a sub-shell which requires user inputs. Is there a way to bring the input prompt to a parallel session or an alternate way to input the values? the outer program doesn't allow to accept the parameter value for the command run in the sub... (8 Replies)
Discussion started by: ahmedwaseem2000
8 Replies
LICENSECHECK(1) 														   LICENSECHECK(1)

NAME
licensecheck - simple license checker for source files SYNOPSIS
licensecheck --help|--version licensecheck [--no-conf] [--verbose] [--copyright] [-l|--lines=N] [-i|--ignore=regex] [-c|--check=regex] [-m|--machine] [-r|--recursive] list of files and directories to check DESCRIPTION
licensecheck attempts to determine the license that applies to each file passed to it, by searching the start of the file for text belonging to various licenses. If any of the arguments passed are directories, licensecheck will add the files contained within to the list of files to process. OPTIONS
--verbose, --no-verbose Specify whether to output the text being processed from each file before the corresponding license information. Default is to be quiet. -l=N, --lines=N Specify the number of lines of each file's header which should be parsed for license information. (Default is 60). -i=regex, --ignore=regex When processing the list of files and directories, the regular expression specified by this option will be used to indicate those which should not be considered (e.g. backup files, VCS metadata). -r, --recursive Specify that the contents of directories should be added recursively. -c=regex, --check=regex Specify a pattern against which filenames will be matched in order to decide which files to check the license of. The default includes common source files. --copyright Also display copyright text found within the file -m, --machine Display the information in a machine readable way, i.e. in the form <file><tab><license>[<tab><copyright>] so that it can be easily sorted and/or filtered, e.g. with the awk and sort commands. Note that using the --verbose option will kill the readability. --no-conf, --noconf Do not read any configuration files. This can only be used as the first option given on the command-line. CONFIGURATION VARIABLES
The two configuration files /etc/devscripts.conf and ~/.devscripts are sourced by a shell in that order to set configuration variables. Command line options can be used to override configuration file settings. Environment variable settings are ignored for this purpose. The currently recognised variables are: LICENSECHECK_VERBOSE If this is set to yes, then it is the same as the --verbose command line parameter being used. The default is no. LICENSECHECK_PARSELINES If this is set to a positive number then the specified number of lines at the start of each file will be read whilst attempting to determine the license(s) in use. This is equivalent to the --lines command line option. LICENSE
This code is copyright by Adam D. Barratt <adam@adam-barratt.org.uk>, all rights reserved; based on a script of the same name from the KDE SDK, which is copyright by <dfaure@kde.org>. This program comes with ABSOLUTELY NO WARRANTY. You are free to redistribute this code under the terms of the GNU General Public License, version 2 or later. AUTHOR
Adam D. Barratt <adam@adam-barratt.org.uk> Debian Utilities 2013-12-23 LICENSECHECK(1)
All times are GMT -4. The time now is 09:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy