perl program to delete the complete record


 
Thread Tools Search this Thread
Operating Systems Linux perl program to delete the complete record
# 1  
Old 05-23-2012
perl program to delete the complete record

Hi all,

I want a perl program to delete the record and its contents from a file if there is no particular line in the record given that all records are separated by a blank line.

For example:
Code:
#100
abcd
efgh
hijk
123
klm

#200
abcd
efgh
hijk
klm

So, the pattern here is 123. If there is no line 123, I want to delete the complete record. #200 does not have line 123 so I want to get rid of that record from #200 till klm. This process is to continue until end of the file.

Thanks in advance.

Last edited by kaav06; 05-25-2012 at 05:13 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

UNIX spool command not extracting complete record from the Oracle table

Hello All, I'm trying to spool an oracle table data into a csv file on unix server but the complete record is not being extracted. The record is almost 1000 characters but only 100 characters are being extracted and rest of the data getting truncated. I'm setting below options : SET... (4 Replies)
Discussion started by: venkat_reddy
4 Replies

2. Shell Programming and Scripting

Delete complete row according to condition

Gents, Please can you help me. In the range 4-24 column the values are duplicate some times and I will like to delete the fist occurrence and keep the last only. The file is not sorted and I can sorted because from column 75 to the end the file is increase by time.. I have a file like this... (10 Replies)
Discussion started by: jiam912
10 Replies

3. UNIX for Dummies Questions & Answers

Perl Script to delete record if it exceeds 199 fields

HI All, I am new to perl ,need your inputs for my better understanding. I have 5 UNIX files ,inside which only required fields will be loaded except with junk data mentioned in double quotes .For Ex File has below information: Process=High Name=Albert Age=27 ... (8 Replies)
Discussion started by: Perlbaby
8 Replies

4. Shell Programming and Scripting

delete record

I have a log file , that keep the record of system activities , as below , now the log is appending so that it becomes very large . " 05/01/08 Normal userA 05/01/08 Normal userB 05/02/08 Alnormal userC " " 10/01/08 Normal userA 10/02/08 Normal userA " Now I would like to keep the... (4 Replies)
Discussion started by: ust
4 Replies

5. UNIX for Dummies Questions & Answers

To output complete record with JOIN

Hi I have 2 files file1 12312341231612634 34534368463786347 23472364287687263 23472357841007237 file2 12123561235176351*dhfsdhfh*2347623462*sdfjshehweu*123651235*sdgfsgfsy*23237346* 23472357841007237*defsjdf*12378234*hsdhfsdhgfsh*12837238947*dsjshgdfs*2348972348*... (1 Reply)
Discussion started by: unxusr123
1 Replies

6. Programming

parent not waiting until child complete executing another program through execl()

Hi, I am calling a program that greps and returns 72536 bytes of data on STDOUT, say about 7000 lines of data on STDOUT. I use pipe from the program am calling the above program. Naturally, I execute the above program (through execl() ) throught the child process and try to read the... (4 Replies)
Discussion started by: vvaidyan
4 Replies

7. UNIX for Advanced & Expert Users

Delete a word and complete line

Hi Canone please provide me solution how can achieve the result below: File1.txt $ sweet appleŁ1 scotish green $ This is a test1 $ sweet mangoŁ2 asia yellow $ This is a test 2 $ sweet apple red (there is no pound symbol here) germany green (1 Reply)
Discussion started by: Aejaz
1 Replies

8. Shell Programming and Scripting

Please complete this program.

Hi All, I need some help to complete the below script, after executing below script blank lines are coming, but i am expecting 4 digit numeric no. Please solve the issue ASAP. function portno { while (true) do random=`echo $RANDOM | cut -c 1-4` port=`netstat -a | grep -c $random` ... (5 Replies)
Discussion started by: sridhusha
5 Replies

9. UNIX for Dummies Questions & Answers

seaching field and getting complete record

hi, I have a file..... 1|3|4|5|6 1|3|4|4|5 now i ahave to search for value 4 in forth field and write that output to a file. if i do grep 4 file1 both lines are coming to output. can somebody help me building command. thanks and regards sandeep (4 Replies)
Discussion started by: mahabunta
4 Replies

10. Shell Programming and Scripting

PERL: wait for process to complete

I'm using PERL on windows NT to try to run an extract of data. I have multiple zip files in multiple locations. I am extracting "*.t" from zip files and subsequently adding that file to one zip file so when the script is complete I should have one zip file with a whole bunch of ".t" files in it. ... (2 Replies)
Discussion started by: dangral
2 Replies
Login or Register to Ask a Question
TDBTOOL(8)						    System Administration tools 						TDBTOOL(8)

NAME
tdbtool - manipulate the contents TDB files SYNOPSIS
tdbtool tdbtool TDBFILE [COMMANDS...] DESCRIPTION
This tool is part of the samba(1) suite. tdbtool a tool for displaying and altering the contents of Samba TDB (Trivial DataBase) files. Each of the commands listed below can be entered interactively or provided on the command line. COMMANDS
create TDBFILE Create a new database named TDBFILE. open TDBFILE Open an existing database named TDBFILE. erase Erase the current database. dump Dump the current database as strings. cdump Dump the current database as connection records. keys Dump the current database keys as strings. hexkeys Dump the current database keys as hex values. info Print summary information about the current database. insert KEY DATA Insert a record into the current database. move KEY TDBFILE Move a record from the current database into TDBFILE. store KEY DATA Store (replace) a record in the current database. show KEY Show a record by key. delete KEY Delete a record by key. list Print the current database hash table and free list. free Print the current database and free list. ! COMMAND Execute the given system command. first Print the first record in the current database. next Print the next record in the current database. check Check the integrity of the current database. quit Exit tdbtool. CAVEATS
The contents of the Samba TDB files are private to the implementation and should not be altered with tdbtool. VERSION
This man page is correct for version 3.0.25 of the Samba suite. AUTHOR
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed. Samba 3.5 06/18/2010 TDBTOOL(8)