12-15-2010
I don't get the logic ...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to delete a set of files in certain directories if there're older than a certain number of days. So I have a text file, with each line containing the directory & number of days.
The format is like this:
dirA,5
dirB,7
How do I write script to iteratively parse this text file & delete... (5 Replies)
Discussion started by: chengwei
5 Replies
2. Shell Programming and Scripting
I would like to know code that will delete multiple text from a comma delimited file. For example, how would the comma delimited file below delete the word 'PEST' in Perl language (previously an excel file that was converted to a csv and the last column was PEST):
1, 2,43,34, bosx,PEST
1,... (1 Reply)
Discussion started by: dolo21taf
1 Replies
3. Shell Programming and Scripting
Hi ,
How to replace all entries of comma in text file by space or other character.
cat temp.txt
A,B,C,D
I want this file to be like
A B C D
Please help!!! (4 Replies)
Discussion started by: prashant43
4 Replies
4. Shell Programming and Scripting
Dear Folks :),
I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp.
I can do this in vi editor by using this command :g/^/s//BBB_
e,g I have a file named as Test.dat and it containins below text:
michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies
5. Shell Programming and Scripting
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies
6. Shell Programming and Scripting
I am trying to generate a report with below file :
File1 :
EQADM,edrtere9-phys,8122caef0,gpatmon,/bin/ksh,nuten Erick
EQADM,edrtere11-phys,8227caef0,gpatmon,/bin/ksh,nuten Erick
EQADM,edrtere3-phys,822caef0,gpatmon,/bin/ksh,nuten Erick
can you help me convert it to html and add... (9 Replies)
Discussion started by: sriram003
9 Replies
7. Shell Programming and Scripting
Hi Guys,
I have text file which is tab/space separated but I want it to re-format into a comma separated and trim the spaces in between. Can someone spare me a perl or sed script that can do the job?
INPUT FILE:
500010245623 500 21-APR-11 05.58.21 PM ... (14 Replies)
Discussion started by: pinpe
14 Replies
8. Shell Programming and Scripting
Hi folks,
Using shell, I am trying the append comma to every line of text.
the requirement is like, I have to open the txt file in unix and read line by line and should add comma at the end of every word to make it single line
txt file
-------
abc@gmail.com
bcd@gmail.com... (7 Replies)
Discussion started by: giridhar276
7 Replies
9. UNIX for Dummies Questions & Answers
my file looks like this:
297 PC Closed 07/10/12 999000098 AMERICAN SOCIETY FOR HEALTHCAR 0.00 USD 1 NAI
i want to look line this:
297,PC,Closed,07/10/12,999000098,AMERICAN SOCIETY FOR HEALTHCAR,0.00,USD,1,NAI (4 Replies)
Discussion started by: lawsongeek
4 Replies
10. Shell Programming and Scripting
Having a huge file in the following format.
2,3,1,,,4
1,2,3,,,,,5,
8,7,3,4,,,,
Output needed is:
2,3,1,0.0,0.0,4
1,2,3,0.0,0.0,0.0,0.0,5,
8,7,3,4,0.0,0.0,0.0,
I have tried reading the file each line, using AWK to parse to find out ",," and then insert 0.0 . It works but very slow. Need... (8 Replies)
Discussion started by: wincrazy
8 Replies
LEARN ABOUT CENTOS
perl::critic::policy::valuesandexpressions::prohibitcommaseparat
Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommUseraContriPerl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements(3)
NAME
Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements - Don't use the comma operator as a statement separator.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Perl's comma statement separator has really low precedence, which leads to code that looks like it's using the comma list element separator
not actually doing so. Conway suggests that the statement separator not be used in order to prevent this situation.
The confusion that the statement separator causes is primarily due to the assignment operators having higher precedence.
For example, trying to combine two arrays into another like this won't work:
@x = @y, @z;
because it is equivalent to
@x = @y;
@z;
Conversely, there are the built-in functions, like "print", that normally force the rest of the statement into list context, but don't when
called like a subroutine.
This is not likely to produce what is intended:
print join q{, }, 2, 3, 5, 7, ": the single-digit primes.
";
The obvious fix is to add parentheses. Placing them like
print join( q{, }, 2, 3, 5, 7 ), ": the single-digit primes.
";
will work, but
print ( join q{, }, 2, 3, 5, 7 ), ": the single-digit primes.
";
will not, because it is equivalent to
print( join q{, }, 2, 3, 5, 7 );
": the single-digit primes.
";
CONFIGURATION
This policy can be configured to allow the last statement in a "map" or "grep" block to be comma separated. This is done via the
"allow_last_statement_to_be_comma_separated_in_map_and_grep" option like so:
[ValuesAndExpressions::ProhibitCommaSeparatedStatements]
allow_last_statement_to_be_comma_separated_in_map_and_grep = 1
With this option off (the default), the following code violates this policy.
%hash = map {$_, 1} @list;
With this option on, this statement is allowed. Even if this option is off, using a fat comma "=>" works, but that forces stringification
on the first value, which may not be what you want.
BUGS
Needs to check for "scalar( something, something )".
AUTHOR
Elliot Shank "<perl@galumph.com>"
COPYRIGHT
Copyright (c) 2007-2011 Elliot Shank.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.16.3 Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements(3)