01-15-2010
Thank you! Scottn. The 1st one works. Actually, i was using awk with the seperator but its not giving the correct output.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
while reading a file line by line
# name of the script is scriptrd
while read line
do
echo $line
done
while executing
bash$ ./scriptrd
if i give the input as
*
the output is like it displays the contents of the current directory
i jus wanted it to print as * (6 Replies)
Discussion started by: brkavi_in
6 Replies
2. Shell Programming and Scripting
i need to read record by record i use script
#!/bin/ksh
for i in 'cat filename'
do
echo $1
done
but i dont get expected result
i just get filename echoed on screen (4 Replies)
Discussion started by: er_zeeshan05
4 Replies
3. UNIX for Advanced & Expert Users
Hi Gurus,
I am having an requirement. i have to read a list file which contains file names and send mail to different users based on the files in the list file.
eg. if file a.txt exists then send a mail to a@a.com
simillary for b.txt,c.txt etc.
Thanks for your help,
Nimu (6 Replies)
Discussion started by: nimu1979
6 Replies
4. Shell Programming and Scripting
Hi,
i have a properties file a.prop where entry is like
PROCESS_IDX=0
Now in my shell schript i am doing like this.
#!/bin/sh
. a.prop
..............
-.......................
while read line
do
# tokenize the string by ",".
var=(`echo $line | tr ',' ' '`)
echo $PROCESS_IDX -->... (6 Replies)
Discussion started by: sailaja_80
6 Replies
5. Shell Programming and Scripting
Hi Guys,
I am having a file which does not have any name when i do a ls -l
-rw-r--r-- 1 dctrdat1 dctrdata 35 Feb 09 08:04
-rw-r--r-- 1 dctrdat1 dctrdata 11961 Feb 08 06:40 DAI_data.txt
Now i want to see what is inside that file. Can you please let me know how to read... (9 Replies)
Discussion started by: mac4rfree
9 Replies
6. Shell Programming and Scripting
i get a name from user first name : last name, in this format. Now i am saving this to a file. what i want is, I do not want to save any name if I already have one entry o that same name..what should i do
for example
user give robert fernandez
this will save in file as robert:fernandez.
if... (5 Replies)
Discussion started by: Learnerabc
5 Replies
7. Shell Programming and Scripting
I have 'n' number of files in a folder .each file in the folder "myfolder" is having the content like.
COLNAME
------------
AAAAAA
BBBBBB
CCCCCC
DDDDDD
...
...
...
ZZZZZZ
26 recrod(s) selected.
My request is by reading each file in "myfolder" and format each file such a way... (18 Replies)
Discussion started by: rocking77
18 Replies
8. Shell Programming and Scripting
I need to extract some content of a file.
Example
file abc
vi abc
ooooooooo
bbbbbbbbb
vvv 1234 5
vvv 6789 3
xxxxxxxxxx
xxxxxxxxxx
i want to extract only the following content from file abc and store in another file say temp.
1234 5
6789 3
what should be my approach? (2 Replies)
Discussion started by: priya_ag04
2 Replies
9. Shell Programming and Scripting
Hi ,
i have a parameter which has path of a file. Now i need to have another parameter with the content of that file. I tried the belwo script , can any one please help.
I dont want to use cat command to read. Can we do it with out using cat command.
while read line
do... (9 Replies)
Discussion started by: Ravindra Swan
9 Replies
10. Programming
is there any unix tools that can read the text files like through SQL queries? (ie in Hadoop, Impala DB support flat file query) (1 Reply)
Discussion started by: omykarshan
1 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::inputoutput::prohibitreadlineinforloop
Perl::Critic::Policy::InputOutput::ProhibitReadlineInForUser(Contributed Perl DocPerl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop(3pm)
NAME
Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop - Write "while( $line = <> ){...}" instead of "for(<>){...}".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Using the readline operator in a "for" or "foreach" loop is very slow. The iteration list of the loop creates a list context, which causes
the readline operator to read the entire input stream before iteration even starts. Instead, just use a "while" loop, which only reads one
line at a time.
for my $line ( <$file_handle> ){ do_something($line) } #not ok
while ( my $line = <$file_handle> ){ do_something($line) } #ok
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
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.14.2 2012-06-07 Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop(3pm)