Help me with cut part 2..


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help me with cut part 2..
# 8  
Old 03-03-2009
Hammer & Screwdriver And a solution using awk

Code:
> echo "xxx.77876767575.abc.77887.iiii" | awk 'BEGIN{FS=IFS=OFS="."} {print $2,$3,$4,$5}'
77876767575.abc.77887.iiii

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to make a loop to read the input from a file part by part?

Hi All, We've a VDI infrastructure in AWS (AWS workspaces) and we're planning to automate the process of provisioning workspaces. Instead of going to GUI console, and launching workspaces by selecting individual users is little time consuming. Thus, I want to create them in bunches from AWS CLI... (6 Replies)
Discussion started by: arun_adm
6 Replies

2. UNIX for Dummies Questions & Answers

How to cut part of a string in reverse?

Hi, how to cut part of a string sing delimiter in reverse input file 1,2,st-pa-tr-01,2,3,4, 2,3,ff-ht-05,6,7,8 how can i obtain strings till st-pa-tr ff-ht i.e cutting the last part og string -01 and -05 Thanks & Regards Nivi edit by bakunin: changed thread title (typo) (3 Replies)
Discussion started by: nivI
3 Replies

3. Shell Programming and Scripting

[Solved] Printing a part of the last line of the specific part of a file

Hi, I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this: Name =A xxxxxx yyyyyy zzzzzz aaaaaa bbbbbb Value = 57 This is necessary because in a file there are written more lines which... (6 Replies)
Discussion started by: wenclu
6 Replies

4. Shell Programming and Scripting

cut the some part in filename

Hi All, I have the file & name is "/a/b/c/d/e/xyz.dat" I need "/a/b/c/d/e/" from the above file name. I tryning with echo and awk. But it not come. Please help me in this regard. Thanks & Regards, Dathu (3 Replies)
Discussion started by: pdathu
3 Replies

5. UNIX for Dummies Questions & Answers

cut and print part of a string

I have a file that contains: yahoo.com.23456 web.log.common.us.gov.8675 192.168.1.55.34443 john-doe.about.com.22233 64.222.3.4.120 sunny.ca.4442 how can i remove the strings after the last dot (.) and reprint the file? Thanks. (3 Replies)
Discussion started by: apalex
3 Replies

6. UNIX for Dummies Questions & Answers

How to cut a string in two parts and show the other part

hi everybody.. I have a string like : abcd:efgh xxyy:yyxx ssddf:kjlioi ghtyu:jkksk nhjkk:heuiiue please tell me how i can display only the characters after ":" in the output the output should be : efgh yyxx kjlioi jkksk heuiiue please give quick reply.. its urgent..!! (6 Replies)
Discussion started by: adityamitra
6 Replies

7. Shell Programming and Scripting

Need to cut a part of a XML file

I want to be able to search and remove a part of this file. For Example I want to make a search for something like Terminal.app and remove the following from the XML file. <dict> <key>GUID</key> <integer>210535539</integer> <key>tile-data</key> <dict> <key>dock-extra</key>... (9 Replies)
Discussion started by: elbombillo
9 Replies

8. Shell Programming and Scripting

cut a part of the file

This is a part of the output file (x.out, from a chemical software). I need to extract the xyz coordinates with the atom labels from this file.If it's possible i would like to use a bash shell script. I am new to this forum, how can I solve this problem. DIPOLE X Y Z ... (1 Reply)
Discussion started by: kurosaki
1 Replies

9. Shell Programming and Scripting

cut part of line

Dear Sirs, I want to cut the IP address from the following text line: " mgmt.mib-2.bgp.bgpPeerTable.bgpPeerEntry.bgpPeerLastError.163.121.170.20 (OctetString): 0x04 00" I want to get the (163.121.170.20) only. Thanks in advance. (8 Replies)
Discussion started by: ahmed.zaher
8 Replies
Login or Register to Ask a Question
Pragmatic(3pm)						User Contributed Perl Documentation					    Pragmatic(3pm)

NAME
Pragmatic - Adds pragmata to Exporter SYNOPSIS
In module MyModule.pm: package MyModule; require Pragmatic; @ISA = qw (Pragmatic); %PRAGMATA = (mypragma => sub {...}); In other files which wish to use MyModule: use MyModule qw (-mypragma); # Execute pragma at import time use MyModule qw (-mypragma=1,2,3); # Pass pragma argument list DESCRIPTION
Pragmatic implements a default "import" method for processing pragmata before passing the rest of the import to Exporter. Perl automatically calls the "import" method when processing a "use" statement for a module. Modules and "use" are documented in perlfunc and perlmod. (Do not confuse Pragmatic with pragmatic modules, such as less, strict and the like. They are standalone pragmata, and are not associated with any other module.) Using Pragmatic Modules Using Pragmatic modules is very simple. To invoke any particular pragma for a given module, include it in the argument list to "use" preceded by a hyphen: use MyModule qw (-mypragma); "Pragmatic::import" will filter out these arguments, and pass the remainder of the argument list from the "use" statement to "Exporter::import" (actually, to "Exporter::export_to_level" so that Pragmatic is transparent). If you want to pass the pragma arguments, use syntax similar to that of the -M switch to perl (see perlrun): use MyModule qw (-mypragma=abc,1,2,3); If there are any warnings or fatal errors, they will appear to come from the "use" statement, not from "Pragmatic::import". Writing Pragmatic Modules Writing Pragmatic modules with Pragmatic is straight-forward. First, "require Pragmatic" (you could "use" it instead, but it exports nothing, so there is little to gain thereby). Declare a package global %PRAGMATA, the keys of which are the names of the pragmata and their corresponding values the code references to invoke. Like this: package MyPackage; require Pragmatic; use strict; use vars qw (%PRAGMATA); sub something_else { 1; } %PRAGMATA = (first => sub { print "@_: first "; }, second => sub { $SOME_GLOBAL = 1; }, third => &something_else, fourth => 'name_of_sub'); When a pragma is given in a "use" statement, the leading hyphen is removed, and the code reference corresponding to that key in %PRAGMATA, or a subroutine with the value's name, is invoked with the name of the package as the first member of the argument list (this is the same as what happens with "import"). Additionally, any arguments given by the caller are included (see "Using Pragmatic Modules", above). EXAMPLES
Using Pragmatic Modules 1. Simple use: use MyModule; # no pragmas use MyModule qw (-abc); # invoke C<abc> use MyModule qw (-p1 -p2); # invoke C<p1>, then C<p2> 2. Using an argument list: use MyModule qw (-abc=1,2,3); # invoke C<abc> with (1, 2, 3) use MyModule qw (-p1 -p2=here); # invoke C<p1>, then C<p2> # with (1, 2, 3) 3. Mixing with arguments for Exporter: (Please see Exporter for a further explanatation.) use MyModule ( ); # no pragmas, no exports use MyModule qw (fun1 -abc fun2); # import C<fun1>, invoke C<abc>, # then import C<fun2> use MyModule qw (:set1 -abc=3); # import set C<set1>, invoke C<abc> # with(3) Writing Pragmatic Modules 1. Setting a package global: %PRAGMATA = (debug => sub { $DEBUG = 1; }); 2. Selecting a method: my $fred = sub { 'fred'; }; my $barney = sub { 'barney'; }; %PRAGMATA = (fred => sub { local $^W = 0; *flintstone = $fred; }, barney => sub { local $^W = 0; *flintstone = $barney; }); 3. Changing inheritance: %PRAGMATA = (super => sub { shift; push @ISA, @_; }); 4. Inheriting pragmata: package X; @ISA = qw(Pragmatic); %PRAGMATA = (debug => 'debug'); $DEBUG = 0; sub debug { ${"$_[0]::DEBUG"} = 1; } package Y: @ISA = qw(X); %PRAGMATA = (debug => 'debug'); $DEBUG = 0; SEE ALSO
Exporter Exporter does all the heavy-lifting (and is a very interesting module to study) after Pragmatic has stripped out the pragmata from the "use". DIAGNOSTICS
The following are the diagnostics generated by Pragmatic. Items marked "(W)" are non-fatal (invoke "Carp::carp"); those marked "(F)" are fatal (invoke "Carp::croak"). No such pragma '%s' (F) The caller tried something like "use MyModule (-xxx)" where there was no pragma xxx defined for MyModule. Invalid pragma '%s' (F) The writer of the called package tried something like "%PRAGMATA = (xxx => not_a_sub)" and either assigned xxx a non-code reference, or xxx is not a method in that package. Pragma '%s' failed (W) The pramga returned a false value. The module is possibly in an inconsisten state after this. Proceed with caution. AUTHORS
B. K. Oxley (binkley) <binkley@alumni.rice.edu> COPYRIGHT
Copyright 1999-2005, B. K. Oxley. This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself. THANKS
Thanks to Kevin Caswick <KCaswick@wspackaging.com> for a great patch to run under Perl 5.8. perl v5.10.1 2009-12-09 Pragmatic(3pm)