Sponsored Content
Top Forums Shell Programming and Scripting Help with UNIX script --Read from one file and delete entries in other Post 302893358 by Samingla on Tuesday 18th of March 2014 06:55:43 PM
Old 03-18-2014
Help with UNIX script --Read from one file and delete entries in other

Hi Guru's

The script has to read an entry from one file and delete the set of lines form other file. Below is the format of the file. In the below example, script should read the entries from input file 2 and delete the entries from input file 1.


Input file 1
Code:
cn: test@test1.com
abc: 111
xyz: true
def: 222
hij: 333

cn: test@test2.com
abc: 222
def: 222
hij: 333

cn: test@test3.com
abc: 222
xyz: true
def: 222
hij: 333

cn: test@test4.com
abc: 222
def: 222
hij: 333

cn: test@test10.com
abc: 222
def: 222
hij: 333


Input File 2:
Code:
cn: test@test1.com
cn: test@test3.com
cn: test@test6.com



Output file:
Code:
cn: test@test2.com
abc: 222
def: 222
hij: 333

cn: test@test4.com
abc: 222
def: 222
hij: 333

cn: test@test10.com
abc: 222
def: 222
hij: 333

Thanks in advance for the help.
Sam

Last edited by Samingla; 03-18-2014 at 09:00 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file read + unix script

hi, how can i read line by line from a file using unix shalle script? Thanks and Regards Vivek.S (2 Replies)
Discussion started by: vivekshankar
2 Replies

2. UNIX for Dummies Questions & Answers

File read/delete synchronization in unix

Hi, I have 2 processes that will be accessing the same file. First process first reads from the file, closes it and then opens it again to write to it (this is done sequentially). The second process may delete the file on some condition. These processes are independent of each other now. What... (2 Replies)
Discussion started by: saumya.c
2 Replies

3. Shell Programming and Scripting

Need Script to delete multiple entries from a file

I am new to Linux and would appreciate some help. I need a script to do the following: My file contains the following entries more file 1 1 1 1 2 2 2 I want to delete multiple entries of 1 and 2 and just keep one of each. The output should look like more file 1 2 Thanks (1 Reply)
Discussion started by: sidewayz
1 Replies

4. Shell Programming and Scripting

Unix script help to read log file

Hi I have a big log file :08,936 DEBUG HttpConnectionManager.getConnection: config = 11:39:08,936 DEBUG Getting free connection, 11:39:08,989 DEBUG Freeing connection, hostConfig=HostConfiguration 11:39:08,989 DEBUG Notifying no-one, there are no waiting threads 11:39:09,046... (4 Replies)
Discussion started by: javaholics
4 Replies

5. Shell Programming and Scripting

Delete lines from file using Unix Script

Hi Experts, I have a file in the below given format. First two lines are header and Trailer. Rest all are transaction Lines. I have to delete all other lines except first line (Header) and lines which contains 5000 in 1st column and 0 in 5th column. Can anyone please kindly provide me with... (6 Replies)
Discussion started by: phani333
6 Replies

6. Shell Programming and Scripting

HP Unix Script to Delete the lines in a file

Hi Experts, I have a file format as mentioned below. I would like to have unix script (HP Unix) which can: 1. Remove first 6 and last 3 lines. 2. Delete the lines where 3rd column having Alpha Numeric Number 3. Delete the lines where 4th column having 0.00 4. Calculate the sum of all the... (16 Replies)
Discussion started by: phani333
16 Replies

7. Shell Programming and Scripting

Unix Script to read the XML file from Website

Hi Experts, I need a unix shell script which can copy the xml file from the below pasted website and paste in in my unix directory. http://www.westpac.co.nz/olcontent/olcontent.nsf/fx.xml Thanks in Advance... (8 Replies)
Discussion started by: phani333
8 Replies

8. UNIX and Linux Applications

Perl Script to read an excel file into an array and search in the UNIX directories

Hi, I want the Perl script with versions 5.8.2 and 5.8.5 starting with #!/usr/bin/perl The Perl program should read the excel file or text file line by line and taking into an array and search in the UNIX directories for reference file of .jsp or .js or .xsl with path .The Object names... (2 Replies)
Discussion started by: pasam
2 Replies

9. UNIX for Dummies Questions & Answers

Read a flat file, evaluate and create output. UNIX SCRIPT.

Hi all, I have a flat file as below; 470423495|1||TSA-A000073800||1|||1 471423495|1||TSA-A000073800||5|||5 472423495|1||TSA-A000073800||2|||7 473423495|1||TSA-A000073800||3|||3 I like to create a Unix script. The script have to valuate the last two columns, if the values are... (4 Replies)
Discussion started by: mrreds
4 Replies

10. Shell Programming and Scripting

Script to delete old entries from a file

I need to remove the file entries that are 30 days old. I have a file with the below data. 111.XX.XX.99 - - "GET /folder1/wp-content" 304 111.XX.XX.99 - - "GET /folder1/wp-content" 304 111.XX.XX.99 - - "GET /folder1/wp-content" 304 111.XX.XX.99 - - "GET /folder1/wp-content" 304... (5 Replies)
Discussion started by: anil510
5 Replies
GET_INCLUDED_FILES(3)							 1						     GET_INCLUDED_FILES(3)

get_included_files - Returns an array with the names of included or required files

SYNOPSIS
array get_included_files (void ) DESCRIPTION
Gets the names of all files that have been included using include(3), include_once(3), require(3) or require_once(3). RETURN VALUES
Returns an array of the names of all files. The script originally called is considered an "included file," so it will be listed together with the files referenced by include(3) and family. Files that are included or required multiple times only show up once in the returned array. EXAMPLES
Example #1 get_included_files(3) example <?php // This file is abc.php include 'test1.php'; include_once 'test2.php'; require 'test3.php'; require_once 'test4.php'; $included_files = get_included_files(); foreach ($included_files as $filename) { echo "$filename "; } ?> The above example will output: abc.php test1.php test2.php test3.php test4.php NOTES
Note Files included using the auto_prepend_file configuration directive are not included in the returned array. SEE ALSO
include(3), include_once(3), require(3), require_once(3), get_required_files(3). PHP Documentation Group GET_INCLUDED_FILES(3)
All times are GMT -4. The time now is 05:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy