Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Removing prefix from multiple files and renaming file extension Post 302324233 by empyrean on Wednesday 10th of June 2009 09:32:08 AM
Old 06-10-2009
Removing prefix from multiple files and renaming file extension

Hello

i have the files in this format

pdb1i0t.ent
pdb1lv7.ent
pdb1pp6.ent
pdb1tj2.ent
pdb1xg2.ent
pdb2b4b.ent
pdb2ewe.ent


Now i have to remove the prefix pdb from all the files and also i need to change the extension of .ent to .txt

The new file should look like this

1iot.txt
1lv7.txt
1pp6.txt

Thankyou for considering my request
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Renaming multiple files, to get rid of extension

I have a good script to rename multiple files, but what's the best way I can remove some text from multiple filenames? Say I have a directory with 35 files with a .XLS at the end, how can I rename them to remove the .XLS but keep everything the same, without having to mv manually. Thanks. (6 Replies)
Discussion started by: nj78
6 Replies

2. Shell Programming and Scripting

Help removing the prefix of more than 10,000 files

I have more than 10,000 files that all start with "raw_ddd_04_*". How can I remove the prefix on these files in a single command? (8 Replies)
Discussion started by: bbbngowc
8 Replies

3. Shell Programming and Scripting

removing a word in a multiple file starting at the dot extension

hi I would like to ask if someone knows a command or a script on how to rename a multiple file in the directory starting at the end of the filename or at the .extension( i would like to remove the last 11 character before the extension) for example Below is the result of my command ls inside... (5 Replies)
Discussion started by: jao_madn
5 Replies

4. UNIX for Dummies Questions & Answers

Rename multiple files, changing prefix, extension and dropping characters

I'm currently only able to perform some very basic functions, so hope this makes sense... I have a set of about 27 files that need to be renamed from something like this: 000012ABCDEFGHIJ.XXX.YYY.ZZZ 000078KLMNO.XXX.YYY.ZZZ 000099PQ.XXX.YYY.ZZZ to something like this: newa012.abc... (11 Replies)
Discussion started by: bbmcg
11 Replies

5. Shell Programming and Scripting

Renaming the extension of a set of files

Hi All, I am trying to rename the extension of a set of file from .txt to .xtx. When I run the following script, #!/bin/sh l=`ls /f` for f in $l do "mv $f ${f%.txt}.xtx" ; done a file such as 1.txt is renamed to 1? where ? is a strange character. Could you please help me fix the code... (3 Replies)
Discussion started by: sara123
3 Replies

6. Shell Programming and Scripting

Split a file into multiple files with an extension

Hi I have a file with 100 million rows. I want to split them into 1000 subfiles and name them from 1.xls to 1000.xls.. Can I do it in awk? Thanks, (8 Replies)
Discussion started by: Diya123
8 Replies

7. UNIX for Dummies Questions & Answers

Renaming Multiple Files by removing characters

Hi I would like to rename Multiple files in a Unix Directory using Ksh Command. Eg ATT8-2011-10-01 00:00:00-MSA-IMM-SINGLE_AND_FAMILY_COVERAGE-DED-$2000-X114817.PDF needs to be renamed as ATT8-2011-10-01-MSA-IMM-SINGLE_AND_FAMILY_COVERAGE-DED-$2000-X114817.PDF Basically the time... (2 Replies)
Discussion started by: pchegoor
2 Replies

8. Shell Programming and Scripting

Curl command to download multiple files with a file prefix

I am using the below curl command to download a single file from client server and it is working as expected curl --ftp-ssl -k -u ${USER}:${PASSWD} ftp://${HOST}:${PORT}/path/to/${FILE} --output ${DEST}/${FILE} let say the client has 3 files hellofile.101, hellofile.102, hellofile.103 and I... (3 Replies)
Discussion started by: r@v!7*7@
3 Replies

9. Shell Programming and Scripting

Copying multiple files and appending time stamp before file extension

Hi, I have multiple files that read: Asa.txt Bad.txt Gnu.txt And I want to rename them using awk to Asa_ddmmyytt.txt and so on ... If there is a single command or more efficient executable please share! Thanks! (4 Replies)
Discussion started by: Jesshelle David
4 Replies

10. Shell Programming and Scripting

Splitting file into multiple files and renaming them

Hi all, Newbie here. First of all, sorry if I made any mistakes while posting this question in terms of rules. Correct me if I am wrong. :b: I have a .dat file whose name is in the format of 20170311_abc_xyz.dat. The file consists of records whose first column consists of multiple dates in... (2 Replies)
Discussion started by: chanduris
2 Replies
SOAP::Packager(3pm)					User Contributed Perl Documentation				       SOAP::Packager(3pm)

NAME
SOAP::Packager - this class is an abstract class which allows for multiple types of packaging agents such as MIME and DIME. DESCRIPTION
The SOAP::Packager class is responsible for managing a set of "parts." Parts are additional pieces of information, additional documents, or virtually anything that needs to be associated with the SOAP Envelope/payload. The packager then will take these parts and encode/decode or "package"/"unpackage" them as they come and go over the wire. METHODS
new Instantiates a new instance of a SOAP::Packager. parts Contains an array of parts. The contents of this array and their types are completely dependent upon the Packager being used. For example, when using MIME, the content of this array is MIME::Entity's. push_part Adds a part to set of parts managed by the current instance of SOAP::Packager. parser Returns the parser used to parse attachments out of a data stream. headers_http This is a hook into the HTTP layer. It provides a way for a packager to add and/or modify HTTP headers in a request/response. For example, most packaging layers will need to override the Content-Type (e.g. multipart/related, or application/dime). ABSTRACT METHODS
If you wish to implement your own SOAP::Packager, then the methods below must be implemented by you according to the prescribed input and output requirements. package() The "package" subroutine takes as input the SOAP envelope in string/SCALAR form. This will serve as the content of the root part. The packager then encapsulates the envelope with the parts contained within "parts" and returns the properly encapsulated envelope in string/SCALAR form. unpackage() The "unpackage" subroutines takes as input raw data that needs to be parsed into a set of parts. It is responsible for extracting the envelope from the input, and populating "parts" with an ARRAY of parts extracted from the input. It then returns the SOAP Envelope in string/SCALAR form so that SOAP::Lite can parse it. SUPPORTED PACKAGING FORMATS
SOAP::Packager::MIME "SOAP::Packager::MIME" utilizes MIME::Tools to provides the ability to send and receive Multipart/Related and Multipart/Form-Data formatted requests and responses. MIME METHODS The following methods are used when composing a MIME formatted message. transfer_encoding The value of the root part's Content-Transfer-Encoding MIME Header. Default is: 8bit. env_id The value of the root part's Content-Id MIME Header. Default is: <main_envelope>. env_location The value of the root part's Content-Location MIME Header. Default is: /main_envelope. env_type The value of the root part's Content-Type MIME Header. Default is: text/xml. OPTIMIZING THE MIME PARSER The use of attachments can often result in a heavy drain on system resources depending upon how your MIME parser is configured. For example, you can instruct the parser to store attachments in memory, or to use temp files. Using one of the other can affect performance, disk utilization, and/or reliability. Therefore you should consult the following URL for optimization techniques and trade-offs: http://search.cpan.org/dist/MIME-tools/lib/MIME/Parser.pm#OPTIMIZING_YOUR_PARSER To modify the parser's configuration options consult the following code sample, which incidentally shows how to minimize memory utilization: my $packager = SOAP::Packager::MIME->new; # $packager->parser->decode_headers(1); # no difference # $packager->parser->extract_nested_messages(1); # no difference $packager->parser->output_to_core(0); # much less memory $packager->parser->tmp_to_core(0); # much less memory $packager->parser->tmp_recycling(0); # promotes faster garbage collection $packager->parser->use_inner_files(1); # no difference my $client = SOAP::Lite->uri($NS)->proxy($URL)->packager($packager); $client->someMethod(); CLIENT SIDE EXAMPLE The following code sample shows how to use attachments within the context of a SOAP::Lite client. #!/usr/bin/perl use SOAP::Lite; use MIME::Entity; my $ent = build MIME::Entity Type => "text/plain", Path => "attachment.txt", Filename => "attachment.txt", Disposition => "attachment"; $NS = "urn:Majordojo:TemperatureService"; $HOST = "http://localhost/cgi-bin/soaplite.cgi"; my $client = SOAP::Lite ->packager(SOAP::Packager::MIME->new) ->parts([ $ent ]) ->uri($NS) ->proxy($HOST); $response = $client->c2f(SOAP::Data->name("temperature" => '100')); print $response->valueof('//c2fResponse/foo'); SERVER SIDE EXAMPLE The following code shows how to use attachments within the context of a CGI script. It shows how to read incoming attachments, and to return attachments to the client. #!/usr/bin/perl -w use SOAP::Transport::HTTP; use MIME::Entity; SOAP::Transport::HTTP::CGI ->packager(SOAP::Packager::MIME->new) ->dispatch_with({'urn:Majordojo:TemperatureService' => 'TemperatureService'}) ->handle; BEGIN { package TemperatureService; use vars qw(@ISA); @ISA = qw(Exporter SOAP::Server::Parameters); use SOAP::Lite; sub c2f { my $self = shift; my $envelope = pop; my $temp = $envelope->dataof("//c2f/temperature"); use MIME::Entity; my $ent = build MIME::Entity Type => "text/plain", Path => "printenv", Filename => "printenv", Disposition => "attachment"; # read attachments foreach my $part (@{$envelope->parts}) { print STDERR "soaplite.cgi: attachment found! (".ref($part).") "; print STDERR "soaplite.cgi: contents => ".$part->stringify." "; } # send attachments return SOAP::Data->name('convertedTemp' => (((9/5)*($temp->value)) + 32)), $ent; } } SOAP::Packager::DIME TODO SEE ALSO
MIME::Tools, DIME::Tools COPYRIGHT
Copyright (C) 2000-2004 Paul Kulchenko. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHORS
Byrne Reese (byrne@majordojo.com) perl v5.12.4 2011-08-18 SOAP::Packager(3pm)
All times are GMT -4. The time now is 03:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy