Sponsored Content
Top Forums Shell Programming and Scripting deleting certain parts of a line in perl Post 302317720 by ghostdog74 on Tuesday 19th of May 2009 08:37:58 PM
Old 05-19-2009
so what have you tried? have you read any Perl documentation regarding string substitution?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing parts of a line with SED

hi, i'm trying to erase all the characters after, and including, the first test test Output: test1 test2 test3 this is what I tried, but didn't work sed "s/*//" file > testfilename any suggestions? thanks, gammmaman (2 Replies)
Discussion started by: gammaman
2 Replies

2. Shell Programming and Scripting

deleting particular lines and moving a line up using perl/sed

Hi, I need convert a dump file in the following format : (please note that line numbers are provided for easy look) Original file: 1 2007-10-2482.90 No trade 0 0.00 100000.00 2 100000.00 3 0.00 4 HOLD 5 2007-10-2589.75 Bought 1114 1114 100000.00 0.00 ... (5 Replies)
Discussion started by: sabyasm
5 Replies

3. Shell Programming and Scripting

[ask]break line number into several parts

hlow all, i have file with wc -l file.txt is 3412112 line number so I want to break these files into several parts with assumsi line 1-1000000 will be create part1.txt and 1000001-2000000 will create part2.txt and 2000001-3000000 will create part3.txt and 3000001-3412112 will create... (5 Replies)
Discussion started by: zvtral
5 Replies

4. Shell Programming and Scripting

perl, splitting out specific parts of the string

Hi there, I have an output from a command like this # ypcat -k netgroup.byuser| grep steven steven.* users_main,users_sysadmin,users_global,users_backup_team and wanted to pull the 'users' netgroups returned into a perl array, that will look like this users_main... (2 Replies)
Discussion started by: rethink
2 Replies

5. UNIX for Dummies Questions & Answers

Help with deleting some parts from text file

Hi all, I have a fat file which contains something like this: ************************************************ blahblahblah blahblahblah Myobject1 HOME ( homecontents01 ( some junk; ) home contents02( some junk; ) ... (7 Replies)
Discussion started by: newboy
7 Replies

6. UNIX for Dummies Questions & Answers

Deleting a pattern in UNIX without deleting the entire line

Hi I have a file: r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e) I want to retain... (15 Replies)
Discussion started by: Alyaa
15 Replies

7. Shell Programming and Scripting

Incrementing parts of ten digits number by parts

I have number in file which contains date and serial number: 2013101000. The last two digits are serial number (00). So maximum of serial number is 100. After reaching 100 it becomes 00 with incrementing 10 which is day with max 31. after reaching 31 it becomes 00 and increments 10... (31 Replies)
Discussion started by: Natalie
31 Replies

8. Shell Programming and Scripting

Separate a hash variable into 2 parts in Perl

Dear Perl users/experts, Could somebody help me how to solve my problem, I have a hash variable that I want to convert into dot file (graphviz). I know how to convert it to dot file but I need some modification on the output of the hash variable before convert it to dot file. Eeach key of... (1 Reply)
Discussion started by: askari
1 Replies

9. Shell Programming and Scripting

Split line in 4 parts

Hi Guys, I have file A.txt 1 2 3 4 5 6 7 8 9 10 11 Want Output :- 1 2 3 (3 Replies)
Discussion started by: pareshkp
3 Replies

10. Shell Programming and Scripting

Extract parts of the line

I have a long list of lines in a txt file which i'm only interested to extract the list of domains like the colored ones. domain.com domain.com/page codes $.09 domain.org domain.org/page2/ codes $0.10 domain.net domain.net/page03 codes $0.05 domain.info ... (3 Replies)
Discussion started by: garfish
3 Replies
Dpkg::Substvars(3)						   libdpkg-perl 						Dpkg::Substvars(3)

NAME
Dpkg::Substvars - handle variable substitution in strings DESCRIPTION
It provides some an object which is able to substitute variables in strings. METHODS
my $s = Dpkg::Substvars->new($file) Create a new object that can do substitutions. By default it contains generic substitutions like ${Newline}, ${Space}, ${Tab}, ${dpkg:Version} and ${dpkg:Upstream-Version}. Additional substitutions will be read from the $file passed as parameter. It keeps track of which substitutions were actually used (only counting substvars(), not get()), and warns about unused substvars when asked to. The substitutions that are always present are not included in these warnings. $s->set($key, $value) Add/replace a substitution. $s->set_as_used($key, $value) Add/replace a substitution and mark it as used (no warnings will be produced even if unused). $s->get($key) Get the value of a given substitution. $s->delete($key) Remove a given substitution. $s->mark_as_used($key) Prevents warnings about a unused substitution, for example if it is provided by default. $s->no_warn($key) Obsolete function, use mark_as_used() instead. $s->load($file) Add new substitutions read from $file. $s->parse($fh, $desc) Add new substitutions read from the filehandle. $desc is used to identify the filehandle in error messages. $s->set_version_substvars($sourceversion, $binaryversion) Defines ${binary:Version}, ${source:Version} and ${source:Upstream-Version} based on the given version strings. These will never be warned about when unused. $s->set_arch_substvars() Defines architecture variables: ${Arch}. This will never be warned about when unused. $newstring = $s->substvars($string) Substitutes variables in $string and return the result in $newstring. $s->warn_about_unused() Issues warning about any variables that were set, but not used $s->set_msg_prefix($prefix) Define a prefix displayed before all warnings/error messages output by the module. $s->save($file) Store all substitutions variables except the automatic ones in the indicated file. "$s" Return a string representation of all substitutions variables except the automatic ones. $str = $s->output($fh) Print all substitutions variables except the automatic ones in the filehandle and return the content written. AUTHOR
Raphael Hertzog <hertzog@debian.org>. 1.16.15 2014-06-05 Dpkg::Substvars(3)
All times are GMT -4. The time now is 02:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy