Sponsored Content
Top Forums Shell Programming and Scripting Perl next if @array (exclude a list of values) Post 302973761 by timj123 on Friday 20th of May 2016 10:10:45 PM
Old 05-20-2016
Yes and Thanks.
I'm trying to remove sections of a file based on an input of values.

Here is a sample of the file I'm trying to "edit"
Code:
section /total/SMS-MT-FSM-DEL-REP045
country: IN
1280363645.979354_PFS_1_1887728354
begin:03
final:56
END

section /total/SMS-MO-FSM001
country: IR
1280105721.484103_PFM_1_1187616097
final:23
END

section /total/SMS-MT-FSM-DEL-REP095
country: IN
1280363645.729309_PFS_1_1084296392
final:43
END

section /total/SMS-MO-FSM001
country: IR
1280105721.484103_PFM_1_1187616097
final:23
END

section /total/SMS-MO-FSM095
country: MO
1280105721.461090_PFM_1_882824215
begin:12
final:89
END

With a list given to me as:
Code:
REP045
REP095

I want to remove the sections of the file related to a list given above.

Desired output:
Code:
section /total/SMS-MO-FSM001
country: IR
1280105721.484103_PFM_1_1187616097
final:23
END

section /total/SMS-MO-FSM095
country: MO
1280105721.461090_PFM_1_882824215
begin:12
final:89
END

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl: Assigning array values..

I have to add a variable value to an array, something like this: ...... @my_array_name = $value_of_this_variable; This doesnt seem to work, any ideas why? Thanks! (4 Replies)
Discussion started by: looza
4 Replies

2. Shell Programming and Scripting

storing values in a list or array

i have a file called file.txt having the following entries. 2321 2311 2313 4213 i wnat to store these values in a list and i want to iterate the list using loop and store it in another list (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

3. Shell Programming and Scripting

perl -write values in a file to @array in perl

Hi can anyone suggest me how to write a file containing values,... say 19 20 21 22 .. 40 to an array @array = (19, 20, ... 40) -- Thanks (27 Replies)
Discussion started by: meghana
27 Replies

4. Shell Programming and Scripting

comparing list values in Perl

Hi, I have tab separated list: KB0005 1019 T IFVATVPVI 0.691 PKC YES KB0005 1036 T YFLQTSQQL 0.785 PKC YES KB0005 1037 S FLQTSQQLK 0.585 DNAPK YES KB0005 508 S ENIISGVSY 0.507 cdc2 YES KB0005 511 S ... (1 Reply)
Discussion started by: karla
1 Replies

5. Shell Programming and Scripting

Greping array values in Bash like Perl

Hi, Is there an easy way to simulate following Perl code in Bash. if ( grep {$my_value eq $_} @ARGV ){ print "Do Something\n"; } else { die "Invalid value"; } (0 Replies)
Discussion started by: paragkalra
0 Replies

6. Shell Programming and Scripting

How to get list of user into an array in perl script

Hi, cut -d: -f1,3 /etc/group >rpt.out I have a doubt in perl. right i am getting list of group user id into rpt.out file. instead i need to store it as an array in perl script. could you please tell me how can i get list of user into an array in perl script.. thanks in advance. (1 Reply)
Discussion started by: solo123
1 Replies

7. Shell Programming and Scripting

How to map the values of an array in perl?

Hi, I have 2 arrays: @names=qw(amith veena chaitra); @files=qw(file.txt file1.txt file3.txt); There is one to one relationship between names and files. There needs to be mapping created between names and files. The output should be like this: amith --> file.txt veena --->... (3 Replies)
Discussion started by: vanitham
3 Replies

8. UNIX for Advanced & Expert Users

Search and replace a array values in perl

Hi, i want to search and replace array values by using perl perl -pi -e "s/${d$i]}/${b$j]}" *.xml i am using while loop for the same. if i excute this,it shows "Substitution replacement not terminated at -e line 1.". please tell me what's wrong this line (1 Reply)
Discussion started by: arindam guha
1 Replies

9. Shell Programming and Scripting

Perl script to verify that a value is present in an array (list)

I have 2 files , i need compare both files field by field, and in the fourth field some value will be interchaged and some value will be **. ex: file1 john|0.0|4|**:25;JP:50;UY:25 file2 john|0.0|4|JP:50;**:25;UY:25 (4 Replies)
Discussion started by: veeruasu
4 Replies

10. Shell Programming and Scripting

Perl : Assigning multile hash values to a single array

I know that @food = %fruit; Works. But how do I assign %fruit and %veggies to @food ? (2 Replies)
Discussion started by: popeye
2 Replies
GSMSMSSTORE(8)						      System Manager's Manual						    GSMSMSSTORE(8)

NAME
gsmsmsstore - SMS store manipulation program SYNOPSIS
gsmsmsstore [ -a ] [ --add ] [ -b baudrate ] [ --baudrate baudrate ] [ -c ] [ --copy ] [ -C service centre address ] [ --sca service centre address ] [ -d destination device or file ] [ --destination destination device or file ] [ -h ] [ --help ] [ -I init string ] [ --init init string ] [ -k ] [ --backup ] [ -l ] [ --list ] [ -s source device or file ] [ --source source device or file ] [ -t SMS store name ] [ --store SMS store name ] [ -v ] [ --version ] [ -V ] [ --verbose ] [ -x ] [ --delete ] [ -X ] [ --xonxoff ] { indices } [ phonenumber text ] DESCRIPTION
gsmsmsstore can store or retrieve SMS messages entries residing in a GSM mobile phone's SMS store to or from a file, add SMS messages to a store, or list the store's contents. Additionally, it is possible to add SMS submit messages to a store. gsmsmsstore reads entries from the source which can be a mobile phone (if a serial device file is given) or a file (if a file name is given). The source is never modified. gsmsmsstore writes SMS messages to a destination file or device in the case of --copy, --backup, and --add. The --list option does not change any file but just lists the contents to standard output. The --backup and --copy options require both source and destination files or devices. The --list option requires a source. The --add and --delete options require a destination file or device. If "-" is given as the parameter for the --source or --destination options, the SMS store is read from standard input and/or written to standard output, respectively. SMS message files are not human-readable. Error messages are printed to the standard error output. If the program terminates on error the error code 1 is returned. OPTIONS
-a, --add Adds an SMS submit message with recipient address phonenumber and text text to the destination. -b baudrate, --baudrate baudrate The baud rate to use. The default baudrate is 38400. -c, --copy This causes the contents of the source to be copied to the destination. After this operation the destination has exactly the same contents as the source. If indices are given on the command line only those SMS messages denoted by the indices are copied to the destination. -C service centre address, --sca service centre address Sets the service centre address to use for all SUBMIT SMSs (may not work with some phones). -d destination, --destination destination The destination device or file. -h, --help Prints an option summary. -I init string, --init init string Initialization string to send to the TA (default: "E0"). Note that the sequence "ATZ" is sent first. -k, --backup This causes those entries to be added from the source to the destination that are not already present in the destination. If indices are given on the command line only those SMS messages denoted by the indices are backed up (ie. added) to the destination. -l, --list Prints out the entire contents of the source in human-readable form. -s source, --source source The source device or file. -t SMS store name, --store SMS store name The name of the SMS store to read from or write to. This information is only used for device sources and destinations. A commonly available message store is "SM" (SIM card). -v, --version Prints the program version. -V, --verbose Prints out a detailed progress report. -x, --delete Delete the SMS messages as denoted by the indices from the destination. -X, --xonxoff Uses software handshaking (XON/XOFF) for accessing the device. EXAMPLES
The following command lists all entries in the mobile phone connected to /dev/mobilephone to the standard output: gsmsmsstore -b 19200 -s /dev/mobilephone -t SM -l The following adds entries 4, 7, and 10 from the device /dev/mobilephone to the file smsstore: gsmsmsstore -s /dev/mobilephone -d /home/fred/smsstore -t SM -b 4 7 10 AUTHOR
Peter Hofmann <software@pxh.de> BUGS
Report bugs to software@pxh.de. Include a complete, self-contained example that will allow the bug to be reproduced, and say which version of gsmsmsstore you are using. COPYRIGHT
Copyright (C) 1999 Peter Hofmann gsmsmsstore is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as pub- lished by the Free Software Foundation; either version 2, or (at your option) any later version. gsmsmsstore is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL- ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with gsmsmsstore; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. SEE ALSO
gsminfo(7), gsmctl(1), gsmpb(1), gsmsendsms(1), gsmsmsd(8). gsmsmsstore v1.10 Sat Jun 16 22:10:00 UTC 2012 GSMSMSSTORE(8)
All times are GMT -4. The time now is 02:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy