Sponsored Content
Top Forums Shell Programming and Scripting search 3 file and write to 4th file (a bit complex) Post 302484003 by anurag.singh on Wednesday 29th of December 2010 09:50:15 AM
Old 12-29-2010
Code:
 
awk '{if(FILENAME=="rollbackip.txt"){a[$1$2]++;next;}if(FILENAME=="ip-port.txt"){b[$3$2]=$4;next;}if(FILENAME=="lookup.txt"){if(a[$1$2]){for(i=3;i<=NF-2;i=i+3) if(b[$i$(i+1)]) $(i+2)=b[$i$(i+1)];print;}}}' rollbackip.txt ip-port.txt lookup.txt

 

10 More Discussions You Might Find Interesting

1. Programming

How to write a code in C to search a file

Dear All, Plz give me some code that how can I search a file through a C program file may be in Present Directory or in its Sub-Directories and it should support Linux Platform. :mad: (6 Replies)
Discussion started by: krishna_sicsr
6 Replies

2. Shell Programming and Scripting

write shell script to search file in folder

hi .. i have a problem how to search file with date and version number(ms_2.0_dd/mm/yy_24)in folder.Here 24 is version number and compare the this file to other file which is in another folder and if does not match then copy this file to respective folder.Also copy different files in different... (1 Reply)
Discussion started by: shubhig15
1 Replies

3. Shell Programming and Scripting

"Search for files in a file and write these files to another file which sould be in some other direc

Hi , Need to shell script to extracts files names and write those to another file in different directory. input file is inputfile.txt abc|1|bcd.dat 123 david123 123 rudy2345 124 tinku5634 abc|1|def.dat 123 jevid123 123 qwer2345 124 ghjlk5634 abc|1|pqr.txt 123 vbjnnjh435 123 jggdy876... (1 Reply)
Discussion started by: dssyadav
1 Replies

4. UNIX for Dummies Questions & Answers

Write 2nd and 3rd fields to a 4th file name?

I have a flatfile A.txt date|products|notes|location 121117|a108|this is a test|florida 121118|b111|just test it|tampa How do i write an awk to create a file name as location.txt and have products:notes awk -F'|' '{ print $2 ":" $3 }' A.txt > $4.txt I am sure it cannot write to... (5 Replies)
Discussion started by: sabercats
5 Replies

5. UNIX for Dummies Questions & Answers

Trying to understand a complex bit of code

Hi, To re-introduce myself, I'm a router guy trying to learn some scripting from the examples in my work place... In a ksh script, one of the script guys wrote the following and I am trying to understand it. I'm hoping someone can explain it to me. The script flow enters a case structure.... (5 Replies)
Discussion started by: Marc G
5 Replies

6. Shell Programming and Scripting

Search and replace from file in awk using a 16 bit text file

Hello, Some time ago a helpful awk file was provided on the forum which I give below: NR==FNR{A=$0;next}{for(j in A){split(A,P,"=");for(i=1;i<=NF;i++){if($i==P){$i=P}}}}1 While it works beautifully on English and Latin characters i.e. within the ASCII range of 127, the moment a character beyond... (6 Replies)
Discussion started by: gimley
6 Replies

7. Shell Programming and Scripting

Need to search a particular String form a file a write to another file using perl script

I have file which contains a huge amount of data. I need to search the pattern Message id. When that pattern is matched I need to get abcdeff0-1g6g-91g3-1z2z-2mm605m90000 to another file. Kindly provide your input. File is like below Jan 11 04:05:10 linux100 |NOTICE... (2 Replies)
Discussion started by: Raysf
2 Replies

8. Shell Programming and Scripting

Search pattern and write line into another file

Hi, I have a file which contains the below details.. My requirement is to fetch all the lines which are starting with "ABC_XY_" into 1 file and rest of the lines (not starting with "ABC_XY_") into another file. Could you please help with what command needs to be used? file1.txt ----------... (12 Replies)
Discussion started by: satyaatcgi
12 Replies

9. Shell Programming and Scripting

Search text beween tags and write to file using awk

Hi Friends, I have a very big text file, that has code for multiple functions. I have scan through the file and write each function in seperate file. All functions starts with BEGIN DSFNC Identifier "ABCDDataValidationfnc" and ends with END DSFNC I need create a file(using identifier)... (2 Replies)
Discussion started by: anandapani
2 Replies

10. Shell Programming and Scripting

Search the specific content from the complex file

Hi, I have a file with complex data without delimiter, have requirement to fetch the specific record based on some charcters. here is my file data ... (12 Replies)
Discussion started by: Riverstone
12 Replies
INFO(1) 							   User Commands							   INFO(1)

NAME
info - read Info documents SYNOPSIS
info [OPTION]... [MENU-ITEM...] DESCRIPTION
Read documentation in Info format. OPTIONS
--apropos=STRING look up STRING in all indices of all manuals. -d, --directory=DIR add DIR to INFOPATH. --dribble=FILENAME remember user keystrokes in FILENAME. -f, --file=FILENAME specify Info file to visit. -h, --help display this help and exit. --index-search=STRING go to node pointed by index entry STRING. -n, --node=NODENAME specify nodes in first visited Info file. -o, --output=FILENAME output selected nodes to FILENAME. -R, --raw-escapes don't remove ANSI escapes from man pages. --restore=FILENAME read initial keystrokes from FILENAME. -O, --show-options, --usage go to command-line options node. --subnodes recursively output menu items. --vi-keys use vi-like and less-like key bindings. --version display version information and exit. The first non-option argument, if present, is the menu entry to start from; it is searched for in all `dir' files along INFOPATH. If it is not present, info merges all `dir' files and shows the result. Any remaining arguments are treated as the names of menu items relative to the initial node visited. EXAMPLES
info show top-level dir menu info emacs start at emacs node from top-level dir info emacs buffers start at buffers node within emacs manual info --show-options emacs start at node with emacs' command line options info -f ./foo.info show file ./foo.info, not searching dir REPORTING BUGS
Email bug reports to bug-texinfo@gnu.org, general questions and discussion to help-texinfo@gnu.org. Texinfo home page: http://www.gnu.org/software/texinfo/ COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING. info 4.3 November 2002 INFO(1)
All times are GMT -4. The time now is 03:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy