11-17-2004
echo "helloworld^M" | sed 's/\^M//'
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
has anyone got any suggestions how i would pick up the string as part of a substitution inclusive of the carriage return.
ie
i want to pick up <<NAME>> from the PS output but the <<; seems to be on the line before the NAME.
Any ideas are appreciated!
... (3 Replies)
Discussion started by: Shakey21
3 Replies
2. Shell Programming and Scripting
Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our... (14 Replies)
Discussion started by: bd_joy
14 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I have a situation where I need to remove the carriage return between the lines.
For.eg.
The input file:
1,ad,"adc
sdfd",edf
2,asd,"def
fde",asd
The output file should be
1,ad,adc sdfd,edf
2,asd,def fde,asd
Thanks
Shash (5 Replies)
Discussion started by: shash
5 Replies
4. Shell Programming and Scripting
Hi I would like to add carriage return at end of file,
because we need to mask the customer names for detailed records.
Some what the file doesnot have carriage at end of line of last record.So that i 'll get 2 records when use
---aa.txt-----
1|aaa|bbb|ccc
2|bbbb|hghgh|ggg
000002
tail... (2 Replies)
Discussion started by: HAA
2 Replies
5. UNIX for Advanced & Expert Users
Hi All,
I am getting a xml file where the first field contains a carriage return and the all other fields doesnot contains any carriage return. So all the other records comes in the second line.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:iSeriesCspIntegration... (3 Replies)
Discussion started by: dasj22
3 Replies
6. Shell Programming and Scripting
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies
7. Shell Programming and Scripting
Hi All,
I am reading two files and writing out the file name and count of lines in each file to an output file.
My script looks like this:
echo "input_file1.out;`wc -l < input_file1.out | sed 's/^]*\(.*\)]*$/\1/'` " > comp_file1.out
echo "input_file2.out;`wc -l < input_file2.out | sed... (2 Replies)
Discussion started by: Hangman2
2 Replies
8. Shell Programming and Scripting
Hi all gurus,
I need help in removing carriage return existed within a record delimited by pipe <|>.
Sample:
A_01|Test1|Testing1|Remarks1
A_02|Test2|Test
ing2|Remarks2
A_03|Test3|Testing3|
Remarks3
Desire output:
A_01|Test1|Testing1|Remarks1
A_02|Test2|Testing2|Remarks2... (10 Replies)
Discussion started by: agathaeleanor
10 Replies
9. Shell Programming and Scripting
Hi,
I try to handle very large numbers with a bash script. I run ssh command in a remote server and store the output in a local variable. But this output contains a return carriage at the end. So I try to remove it by tr But I can't figure out the right notation with printf. So my problem... (6 Replies)
Discussion started by: Meacham12
6 Replies
10. UNIX for Dummies Questions & Answers
I need to remove the carriage return comes inbetween the record.
Need to have CR only at the end.
I used the below command.
tr -d '\n' < filewithcarriagereturns > filewithoutcarriagereturns
But its removing all the CR and giving one line output.
Input File:
12345
abcdegh... (11 Replies)
Discussion started by: srvn_saru
11 Replies
LEARN ABOUT DEBIAN
cpanplus::shell::default::plugins::howto
CPANPLUS::Shell::Default::Plugins::HOWTO(3perl) Perl Programmers Reference Guide CPANPLUS::Shell::Default::Plugins::HOWTO(3perl)
NAME
CPANPLUS::Shell::Default::Plugins::HOWTO -- documentation on how to write your own plugins
SYNOPSIS
package CPANPLUS::Shell::Default::Plugins::MyPlugin;
### return command => method mapping
sub plugins { ( myplugin1 => 'mp1', myplugin2 => 'mp2' ) }
### method called when the command '/myplugin1' is issued
sub mp1 { .... }
### method called when the command '/? myplugin1' is issued
sub mp1_help { return "Help Text" }
DESCRIPTION
This pod text explains how to write your own plugins for "CPANPLUS::Shell::Default".
HOWTO
Registering Plugin Modules
Plugins are detected by using "Module::Pluggable". Every module in the "CPANPLUS::Shell::Default::Plugins::*" namespace is considered a
plugin, and is attempted to be loaded.
Therefor, any plugin must be declared in that namespace, in a corresponding ".pm" file.
Registering Plugin Commands
To register any plugin commands, a list of key value pairs must be returned by a "plugins" method in your package. The keys are the
commands you wish to register, the values are the methods in the plugin package you wish to have called when the command is issued.
For example, a simple 'Hello, World!' plugin:
package CPANPLUS::Shell::Default::Plugins::HW;
sub plugins { return ( helloworld => 'hw' ) };
sub hw { print "Hello, world!
" }
When the user in the default shell now issues the "/helloworld" command, this command will be dispatched to the plugin, and its "hw" method
will be called
Registering Plugin Help
To provide usage information for your plugin, the user of the default shell can type "/? PLUGIN_COMMAND". In that case, the function
"PLUGIN_COMMAND_help" will be called in your plugin package.
For example, extending the above example, when a user calls "/? helloworld", the function "hw_help" will be called, which might look like
this:
sub hw_help { " /helloworld # prints "Hello, world!
" }
If you dont provide a corresponding _help function to your commands, the default shell will handle it gracefully, but the user will be
stuck without usage information on your commands, so it's considered undesirable to omit the help functions.
Arguments to Plugin Commands
Any plugin function will receive the following arguments when called, which are all positional:
Classname -- The name of your plugin class
Shell -- The CPANPLUS::Shell::Default object
Backend -- The CPANPLUS::Backend object
Command -- The command issued by the user
Input -- The input string from the user
Options -- A hashref of options provided by the user
For example, the following command:
/helloworld bob --nofoo --bar=2 joe
Would yield the following arguments:
sub hw {
my $class = shift; # CPANPLUS::Shell::Default::Plugins::HW
my $shell = shift; # CPANPLUS::Shell::Default object
my $cb = shift; # CPANPLUS::Backend object
my $cmd = shift; # 'helloworld'
my $input = shift; # 'bob joe'
my $opts = shift; # { foo => 0, bar => 2 }
....
}
BUG REPORTS
Please report bugs or other issues to <bug-cpanplus@rt.cpan.org<gt>.
AUTHOR
This module by Jos Boumans <kane@cpan.org>.
COPYRIGHT
The CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans <kane@cpan.org>. All rights reserved.
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.
SEE ALSO
CPANPLUS::Shell::Default, CPANPLUS::Shell, cpanp
perl v5.14.2 2011-09-26 CPANPLUS::Shell::Default::Plugins::HOWTO(3perl)