Sponsored Content
Top Forums Shell Programming and Scripting using perl to print columnwise Post 302339594 by pludi on Friday 31st of July 2009 02:44:47 AM
Old 07-31-2009
Quote:
Originally Posted by KevinADC
the line numbers in file one do not seem match the output and the line numbers in the file have to be offset by negative one to match in the array, which will start at zero instead of one like the file.
I assumed that the lines "FAAA_HUMAN.input1" and "FAAA_HUMAN.output" are filenames, not actual content.
Quote:
Originally Posted by KevinADC
@numers should probably be chomped to remove the newlines before using it with the numeric operator ==.
You're right, they should be chomp()ed (for good style points), but I tried both (chomp()ing and the posted version), there's no difference.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

rearranging the data in file (from columnwise to rowwise)

Hi I have one file which is having data like 10201 10202 10205 10206 10207 10208 10209 10210 10211 10213 10215 10801 10802 11406 11415 11422 11426 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11530 11604 11608 11611 11717 11718 11719 11722 11725... (3 Replies)
Discussion started by: reldb
3 Replies

2. Shell Programming and Scripting

awk with paste ... columnwise

Hi, I'm trying to plot some data using the awk to find and parse the data and then use gnuplot to plot it up. I'd like to plot one or more range cells (let the user decide!). I've been able to write up the code such that I can plot one range cell per plot, but I just can't see how to get more... (1 Reply)
Discussion started by: dpath2o
1 Replies

3. Shell Programming and Scripting

Trying to print data row/columnwise

PRDCNT=12 FILS= f1=1 f2=2 f3=3 f4=4 f5=5 CNT=0 CNT=`expr $PRDCNT - 5` MNT=6 VR=1 while do f$VR="$f$VR,$MNT" echo "$f$VR" MNT=`expr $MNT + 1` CNT=`expr $CNT - 1` VR=`expr $VR + 1` if then (8 Replies)
Discussion started by: swaminathanks
8 Replies

4. Shell Programming and Scripting

Comparing files columnwise and print the differences in third file

Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue: I have 2 files say, File 1: a|4|7 b|3|2 c|8|8 d|8|9 File 2: a|4|6 b|2|2 c|8|8 d|9|8 The third file(output file) should have: Data mismatch in row 1 column 3 Data mismatch in row 2 coumn 2 Data... (3 Replies)
Discussion started by: abhijeet1409
3 Replies

5. Shell Programming and Scripting

Insert records in a file columnwise

Hello everyone!!!!! Need some help on inserting data in a file columnwise. Example: File1: 1|AAA|25|2 5|qqe|20|7 4|wer|31|81 I need to create a second file in which data can be inserted in a columnwise manner i.e. File2: AAA|25|1|2 qqe|20|5|7 wer|31|4|81 The order of columns in... (1 Reply)
Discussion started by: abhijeet1409
1 Replies

6. UNIX for Advanced & Expert Users

Insert records in a file columnwise

Hello everyone!!!!! Need some help on inserting data in a file columnwise. Example: File1: 1|AAA|25|2 5|qqe|20|7 4|wer|31|81 I need to create a second file in which data can be inserted in a columnwise manner i.e. File2: AAA|25|1|2 qqe|20|5|7 wer|31|4|81 The order of columns in... (1 Reply)
Discussion started by: abhijeet1409
1 Replies

7. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies

8. Shell Programming and Scripting

Trim a file columnwise

Hi All, I want to trim each columns leading & trailing (like sql trim function) of a ',' separated file.. I've a file like this.. manab , c gi lucky , home babu , maa I want the output as manab,c gi lucky,home babu,maa A one liner would be a great help. (2 Replies)
Discussion started by: manab86
2 Replies

9. Shell Programming and Scripting

File comparison in UNIX columnwise

Hi all, I want to compare two files with same number of rows and columns with records in same order. Just want to highlight the differences in the column values if any. file A 1,kolkata,19,ab 2,delhi,89,cd 3,bangalore,56,ef file2: 1,kolkata,21,ab 2,mumbai,89,gh 3,bangalore,11,kl... (9 Replies)
Discussion started by: prabhat.diwaker
9 Replies

10. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies
Arch::Util(3pm) 					User Contributed Perl Documentation					   Arch::Util(3pm)

NAME
Arch::Util - Arch utility functions SYNOPSIS
use Arch::Util qw(run_tla load_file save_file setup_config_dir); my $abrowse_output = run_tla('abrowse --summary --date --creator'); my ($full_version) = run_tla('tree-version'); my @full_revisions = run_tla('logs', '-r', '-f'); my $cfg_dir = setup_config_dir(undef, "archipelago"); my $content = load_file("$cfg_dir/versions.cfg"); $content =~ s/^last_version = .*/last_version = $full_version/m; save_file("$cfg_dir/versions.cfg", $content); DESCRIPTION
A set of helper functions suitable for GNU Arch related projects in Perl. Higher (object oriented) levels of Arch/Perl library make use of these helper functions. FUNCTIONS
The following functions are available: run_tla, run_cmd, run_pipe_from, load_file, save_file, copy_dir, remove_dir, setup_config_dir, standardize_date, date2daysago, date2age, parse_creator_email, adjacent_revision. The system functions die on errors. is_tla_functional Verify whether the system has a working arch backend installed (and possibly configured by environment variables, like TLA or ARCH_BACKEND), needed for this perl library to function. run_tla subcommand_with_args run_tla subcommand arg ... Run the given tla subcommand with optional arguments. Return the tla output in the scalar context, and a list of chomp-ed lines in the list context. run_cmd shell_command_with_args run_cmd shell_command arg ... Run the given shell command (like wc or awk) with optional arguments. Return the command output in the scalar context, and a list of chomp-ed lines in the list context. run_tla is implemented using run_cmd. run_pipe_from shell_command_with_args run_pipe_from shell_command arg ... Run the given shell command (like ls or tar) with optional arguments in the separate process. Return the pipe (file handle) that may be used to read the command output from. run_cmd is implemented using run_pipe_from. load_file file_name load_file file_name scalar_ref load_file file_name array_ref Load the given file_name. Return the file content if the returning value is expected. As a side effect, may modify the scalar_ref or array_ref if given, in the last case all file lines are split and chomp-ed. save_file file_name content Save the given content in the given file_name. The content may be either scalar, scalar ref, or array ref (see load_file). copy_dir dir1 dir2 Copy dir1 to dir2 recursivelly, preserving as many attributes as possible. remove_dir dir .. Remove dir (or dirs) recusivelly. Please be careful. setup_config_dir setup_config_dir dir setup_config_dir dir subdir ... Create (if needed) the configuration dir that defaults to either $ARCH_MAGIC_DIR or ~/.arch-magic or /tmp/.arch-magic if $HOME is unset. If one or more consecutive subdir given, repeat the same procedure for the sub-directory (including creating and diagnostics if needed). Return a name of the existing directory (including sub-directories if any). standardize_date default_unix_date_string Try to convert the given date string to "yyyy-mm-dd HH:MM:SS TMZ". If failed, the original string is returned. date2daysago date_string Convert a date string to time difference to now in full days. In list content, return (num_days_ago, unix_time, timezone_str). date2age date_string Like date2daysago, but return a human readable string, like "5 days" or "-6 weeks" or "7 months" or "3 years". parse_creator_email my_id Try to parse the arch my-id of the patch creator. Return a list of his/her name and email. adjacent_revision full_revision offset Given the full_revision and positive or negative offset, try to guess the full name of the adjacent revision. BUGS
Awaiting for your reports. AUTHORS
Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel). SEE ALSO
For more information, see tla, Arch. perl v5.10.1 2010-03-08 Arch::Util(3pm)
All times are GMT -4. The time now is 06:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy