Sponsored Content
Top Forums Shell Programming and Scripting Perl - How do you break the long line of codes into 2? Post 302294845 by otheus on Friday 6th of March 2009 03:33:14 AM
Old 03-06-2009
He's using the shell because it's a tad easier to redirect to a new file than to setup Perl's filedescriptor. Still, I wouldn't use backtick operators here, because there's no output from the command to be captured and used by perl.

Instead, I would do this:
Code:
$cmd=q(echo "whatever") . 
q(> somefile.txt);
system $cmd;
# OR
`$cmd`

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get exit status codes in bash from Perl?

I apologize if I have already posted this query. I scanned back quite a few pages but could not find such a query. If my perl code contains "exit(33)" how can I get that value in bash for use in a "if" statement. Thanks, Siegfried (5 Replies)
Discussion started by: siegfried
5 Replies

2. Shell Programming and Scripting

TO break a line

hi All, Have a doubt in ksh..Am not familiar with arrays but i have tried out a script.. plzzzzz correct me with the script My i/p File is: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.2.2) (Port = 1525) ) ) (CONNECT_DATA = (SID = TESTDB1) ) ) ... (7 Replies)
Discussion started by: aajan
7 Replies

3. Shell Programming and Scripting

bash awk codes to perl

Hi, I am interesting in writing the following bash codes into perl My script is simple take field 2 in /etc/passwd and put into an array #!/bin/bash PASSWD_FILE=/etc/passwd A=(`awk -F: ' { print $2 }' $PASSWD_FILE `) Can someone give me equivalent codes in perl ? (1 Reply)
Discussion started by: phamp008
1 Replies

4. Shell Programming and Scripting

Perl break a file

I am trying to break a large file into smaller ones, with the break defined by the character "*". The following is the code I have so far which breaks the input file on every line instead of at the "*" character. Input file: 1 2 3 4 *5 6 7 8 9 Code: #!/usr/bin/perl... (2 Replies)
Discussion started by: cold_Que
2 Replies

5. Shell Programming and Scripting

BASH: Break line, read, break again, read again...

...when the lines use both a colon and commas to separate the parts you want read as information. The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

6. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

7. Shell Programming and Scripting

Add line break for each line in a file

I cannot seem to get this to work.. I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application. the file looks like this this is a test that is a test balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies

8. UNIX for Dummies Questions & Answers

VI Line Break?

So I'm in a Unix class and our assignment was to go into VI and write a script to make this file tree. At the end of it, I'd like it to echo "This is the file tree you've created" then a line break, then . But I'm not sure as to who to do it. Is there a way for when I run it (./filesystem), the... (4 Replies)
Discussion started by: bbowers
4 Replies

9. Shell Programming and Scripting

How to break the line to the one above?

Hello everyone! I'm trying to make the below file1 look like file2, can anyone help? Basically I just hit backspace on every line that starts with a number. Thanks! file1: THIS#IS-IT1 4 THIS#IS-IT2 3 THIS#IS-IT3 2 THIS#IS-IT4 1 Result > file2: (4 Replies)
Discussion started by: demmel
4 Replies

10. Shell Programming and Scripting

Break one long string into multiple fixed length lines

This is actually a KSH under Unix System Services (Z/OS), but hoping I can get a standard AIX/KSH solution to work... I have a very large, single line file in Windows, that we download via FTP, with the "SITE WRAP" option, into a Z/OS file with an LRECL of 200. This essentially breaks the single... (4 Replies)
Discussion started by: bubbawuzhere
4 Replies
Catalyst::Plugin::I18N(3pm)				User Contributed Perl Documentation			       Catalyst::Plugin::I18N(3pm)

NAME
Catalyst::Plugin::I18N - I18N for Catalyst SYNOPSIS
use Catalyst 'I18N'; print join ' ', @{ $c->languages }; $c->languages( ['de'] ); print $c->localize('Hello Catalyst'); Use a macro if you're lazy: [% MACRO l(text, args) BLOCK; c.localize(text, args); END; %] [% l('Hello Catalyst') %] [% l('Hello [_1]', 'Catalyst') %] [% l('lalala[_1]lalala[_2]', ['test', 'foo']) %] [% l('messages.hello.catalyst') %] DESCRIPTION
Supports mo/po files and Maketext classes under your application's I18N namespace. # MyApp/I18N/de.po msgid "Hello Catalyst" msgstr "Hallo Katalysator" # MyApp/I18N/i_default.po msgid "messages.hello.catalyst" msgstr "Hello Catalyst - fallback translation" # MyApp/I18N/de.pm package MyApp::I18N::de; use base 'MyApp::I18N'; our %Lexicon = ( 'Hello Catalyst' => 'Hallo Katalysator' ); 1; CONFIGURATION You can override any parameter sent to Locale::Maketext::Simple by specifying a "maketext_options" hashref to the "Plugin::I18N" config section. For example, the following configuration will override the "Decode" parameter which normally defaults to 1: __PACKAGE__->config( 'Plugin::I18N' => maketext_options => { Decode => 0 } ); All languages fallback to MyApp::I18N which is mapped onto the i-default language tag. If you use arbitrary message keys, use i_default.po to translate into English, otherwise the message key itself is returned. EXTENDED METHODS setup METHODS languages Contains languages. $c->languages(['de_DE']); print join '', @{ $c->languages }; language return selected locale in your locales list. language_tag return language tag for current locale. The most notable difference from this method in comparison to "language()" is typically that languages and regions are joined with a dash and not an underscore. $c->language(); # en_us $c->language_tag(); # en-us installed_languages Returns a hash of { langtag => "descriptive name for language" } based on language files in your application's I18N directory. The descriptive name is based on I18N::LangTags::List information. If the descriptive name is not available, will be undef. loc localize Localize text. print $c->localize( 'Welcome to Catalyst, [_1]', 'sri' ); SEE ALSO
Catalyst AUTHORS
Sebastian Riedel <sri@cpan.org> Brian Cassidy <bricas@cpan.org> Christian Hansen <chansen@cpan.org> COPYRIGHT AND LICENSE
Copyright (c) 2005 - 2009 the Catalyst::Plugin::I18N "AUTHORS" as listed above. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-06-14 Catalyst::Plugin::I18N(3pm)
All times are GMT -4. The time now is 09:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy