Sponsored Content
Top Forums Shell Programming and Scripting How search a list of numbers from a file Post 302552033 by pinpe on Thursday 1st of September 2011 11:31:57 AM
Old 09-01-2011
How search a list of numbers from a file

Hi Guys!

I have two input files. I want to search each of the numbers (studentid) on inputfile1 from inputfile2 and print the studentid and section that are listed from inputfile1. See the desired output below.


inputfile1.txt:
Code:
studentid
261054689
266605695
269826642
264966513
267759044


inputfile2.txt:
Code:
studentid,class
269356045,100
264679884,100
266565812,440
261167017,440
274742653,100
261054689,440
268487469,440
266747948,100
261056733,440
269466302,100
269826642,430
264161985,100
264751425,440
267759044,100
267636636,100
268619810,100
269610516,430
261105733,440
264966513,100
267827396,440
266288625,100
266605695,100
266122563,390
266665542,440
267704403,440
268251798,100


Desired Output:
Code:
261054689,440
266605695,100
269826642,430
264966513,100
267759044,100


Thanks in advance.


Br,
pinpe
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Search a list of lines in file into files

I have a file (file1) which is like host1 host2 host3 host4 the list goes on............ Now I want the above lines in files to be compared with files under /opt/new/ File names are as below: Dev Prod QA And suppose host1 from file1 is found under Dev(file under /opt/new)... (2 Replies)
Discussion started by: sriram003
2 Replies

2. UNIX for Dummies Questions & Answers

how to search and list file with wildcard character

hi, I want to search all files in the current working direcotry and to print in comma (,) seperated output. But I have two patterns to search for. Files will be in ABC20100508.DAT format. Search should happen on the format (ABC????????.DAT) along with date(20100508). I can do a ls... (2 Replies)
Discussion started by: anandapani
2 Replies

3. Shell Programming and Scripting

Script to search a large file with a list of terms in another file

Hi- I am trying to search a large file with a number of different search terms that are listed one per line in 3 different files. Most importantly I need to be able to do a case insensitive search. I have tried just using egrep -f but it doesn't seam to be able to handle the -i option when... (3 Replies)
Discussion started by: dougzilla
3 Replies

4. UNIX for Dummies Questions & Answers

Search String in File List

Hi, I have a list of files which can be identified as abcd*.xml where * represent multiple timestamps for multiple files. I need to do following checks 1. Find number of files (which we get by doing following) FILECOUNT=`ls -ltr /dir/abcd*.xml | wc -l` 2. If check 1 gives '1' as... (2 Replies)
Discussion started by: dsrookie
2 Replies

5. Shell Programming and Scripting

Search only numbers in a file

Hello team, Suppose I have a file named that has following content: abc123 1897 msxi12 ------------ ######## ((((( rapjagc ))))))) 34229 xxxxxxxxxxxx @@@536 I need those lines that contain only numbers from this file. means -- it should eliminate alphanumber, special characters... (3 Replies)
Discussion started by: singhabm
3 Replies

6. Shell Programming and Scripting

List file's name and search string's Line

Hi all, My need is: To list out all the java / jsp files having System.out.println in my project. I need the output as: /home/me/project/file1.java somejavacode somejavacode System.out.println("something"); somejavacode somejavacode somejavacode /home/me/project/file2.java... (8 Replies)
Discussion started by: linuxadmin
8 Replies

7. Shell Programming and Scripting

Take a list if strings from a file and search them in a list of files and report them

I have a file 1.txt with the below contents. -----cat 1.txt----- 1234 5678 1256 1234 1247 ------------------- I have 3 more files in a folder -----ls -lrt------- A1.txt A2.txt A3.txt ------------------- The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies

8. UNIX for Dummies Questions & Answers

How to search & list subdirectories with the given file name

Question: How to search & list subdirectories with the given file name? For example: The directory structure looks like; /Builds/DEV/Build_RL01/DDL/ a_tbl_cre.sql ...... /Builds/DEV/Build_RL01/DML/ a_upd.sql .... .... Requirements: 1. I need to find subdirectory DML which is... (0 Replies)
Discussion started by: Siva SQL
0 Replies

9. Shell Programming and Scripting

Search within file1 numbers from list in file2

Hello to all, I hope somebody could help me with this: I have this File1 (real has 5 million of lines): Number Category --------------- -------------------------------------- 8734060355 3 8734060356 ... (6 Replies)
Discussion started by: Ophiuchus
6 Replies

10. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies
KLDCONFIG(8)						    BSD System Manager's Manual 					      KLDCONFIG(8)

NAME
kldconfig -- display or modify the kernel module search path SYNOPSIS
kldconfig [-dfimnUv] [-S sysctlname] [path ...] kldconfig -r DESCRIPTION
The kldconfig utility displays or modifies the search path used by the kernel when loading modules using the kldload(8) utility or the kldload(2) syscall. The following options are available: -d Remove the specified paths from the module search path. -f Do not display a diagnostic message if a path specified for adding is already present in the search path, or if a path specified for removing is not present in the search path. This may be useful in startup/shutdown scripts for adding a path to a file system which is still not mounted, or in shutdown scripts for unconditionally removing a path that may have been added during startup. -i Add the specified paths to the beginning of the search path, not to the end. This option can only be used when adding paths. -m Instead of replacing the module search path with the set of paths specified, ``merge'' in the new entries. -n Do not actually change the module search path. -r Display the current search path. This option cannot be used if any paths are also specified. -S sysctlname Specify the sysctl name to use instead of the default kern.module_path. -U ``Unique-ify'' the current search path - if any of the directories is repeated one or more times, only the first occurrence remains. This option implies -m. -v Verbose output: display the new module search path. If the path has been changed, and the -v flag is specified more than once, the old path is displayed as well. FILES
/boot/kernel, /boot/modules, /modules The default module search path used by the kernel. EXIT STATUS
The kldconfig utility exits 0 on success, and >0 if an error occurs. SEE ALSO
kldload(2), kldload(8), sysctl(8) HISTORY
The kldconfig utility first appeared in FreeBSD 4.4. AUTHORS
Peter Pentchev <roam@FreeBSD.org> BSD
June 15, 2001 BSD
All times are GMT -4. The time now is 01:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy