Sponsored Content
Full Discussion: Copy/Paste data in files
Top Forums UNIX for Dummies Questions & Answers Copy/Paste data in files Post 302380324 by daptal on Monday 14th of December 2009 09:52:32 PM
Old 12-14-2009
Wrench

Try inline perl if that helps

Code:
 cat abc.txt | perl -e '
$i=2;
while(<>){
chomp ;
($h,$hash{r}{$i},$hash{v}{$i},$hash{d}{$i}) = split(" ");
$i++;
}
for my $i (2..8){
for my $var ('r','v','d'){
        print uc($var)."$i=$hash{$var}{$i}\n";

}
}
'

HTH,
PL

Last edited by daptal; 12-14-2009 at 10:55 PM.. Reason: change in the for loop to include 8
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cut, copy + paste

Hi all! How do I cut, copy and paste under unix??? (2 Replies)
Discussion started by: aitor314
2 Replies

2. Shell Programming and Scripting

Search, copy and paste

Can i search in a file for more than one string at a time? And copy the next string after that and paste it in column style? Is it possible? Thanks! (4 Replies)
Discussion started by: kingpeejay
4 Replies

3. Shell Programming and Scripting

copy/paste with awk

Hi everybody, I have two XML files. I am working on a script that could copy and paste the contents of the first xml file to the desired location in the second xml file. Here is my first XML file. This is the second XML file. Finaly, I wnat to obtain something like that : ... (2 Replies)
Discussion started by: lsaas
2 Replies

4. UNIX for Dummies Questions & Answers

Copy/Paste in Vi editor

Dear All, I have a file containing 12 lines. First 3 lines have 9 values and the remaining 9 lines with no values. I was trying to copy and paste these 9 values of the first 3 lines into last 9 lines simultaneously as A=1.491331, B=1.539000 ..... but I don't know how to cope with this... (9 Replies)
Discussion started by: sullah
9 Replies

5. Shell Programming and Scripting

Copy and Paste to a new document

Hello, I am quite new to shell scripting so don't know all the tools available. What I'm trying to do is open a file optimal.txt search for objectiveValue and copy the number in quotes next to it. e.g. ... solutionName="incumbent" solutionIndex="-1" objectiveValue="13246" ... (6 Replies)
Discussion started by: StephanR
6 Replies

6. Shell Programming and Scripting

Copy and paste data

I need to copy from specified lines and paste the data into several other lines. XX123450008 xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x XX123451895 xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x xx.x ...... XX123452012 xx.x xx.x xx.x xx.x xx.x xx.x xx.x... (13 Replies)
Discussion started by: ncwxpanther
13 Replies

7. UNIX for Dummies Questions & Answers

Copy/paste in vi editor

Hello guys, I am trying to copy a line in vi editor and paste it with below commands but paste command is not working and instead of paste action prints the p character!! I should also mention that the server is Solaris... 1) crontab -e 2) j to move down 3) yy to copy the line 4) o to... (4 Replies)
Discussion started by: Newman
4 Replies

8. UNIX for Beginners Questions & Answers

Copy data at specified location from multiple files

Hello everyone, Im super new to coding but increasingly in need of it at work. Im have task stacked because of this problems, that I cannot figure out how to solve looking on the internet after trying many many things that looked similar to me. I have multiple data files of the form (see below).... (2 Replies)
Discussion started by: Xfiles_fan
2 Replies

9. UNIX for Beginners Questions & Answers

How to copy a column of multiple files and paste into new excel file (next to column)?

I have data of an excel files as given below, file1 org1_1 1 1 2.5 100 org1_2 1 2 5.5 98 org1_3 1 3 7.2 88 file2 org2_1 1 1 2.5 100 org2_2 1 2 5.5 56 org2_3 1 3 7.2 70 I have multiple excel files as above shown. I have to copy column 1, column 4 and paste into a new excel file as... (26 Replies)
Discussion started by: dineshkumarsrk
26 Replies

10. UNIX for Beginners Questions & Answers

How to copy particular files from a multiple directories and paste in a new directory?

Dear all I have a multiple directories, say for example org1, org2, org3 ..... org100 and each directory having a file namely dnaG.fasta. I need to copy all the dnaG.fasta file from each directory and paste in another directory fastconcatg. Therefore, my script has to copy dnaG.fasta file from... (5 Replies)
Discussion started by: dineshkumarsrk
5 Replies
Perl::Critic::Policy::Variables::ProhibitEvilVariables(3User Contributed Perl DocumentaPerl::Critic::Policy::Variables::ProhibitEvilVariables(3pm)

NAME
Perl::Critic::Policy::Variables::ProhibitEvilVariables - Ban variables that aren't blessed by your shop. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Use this policy if you wish to prohibit the use of specific variables. These may be global variables warned against in "perlvar", or just variables whose names you do not like. CONFIGURATION
The set of prohibited variables is configurable via the "variables" and "variables_file" options. The value of "variables" should be a string of space-delimited, fully qualified variable names and/or regular expressions. An example of prohibiting two specific variables in a .perlcriticrc file: [Variables::ProhibitEvilVariables] variables = $[ $^S $SIG{__DIE__} If you prohibit an array or hash (e.g. @INC), use of elements of the array or hash will be prohibited as well. If you specify a subscripted variable (e.g. $SIG{__DIE__}), only the literal subscript specified will be detected. The above <.perlcritic> file, for example, will cause "perlcritic(1)" to detect "$SIG{__DIE__} = &foo", but not my $foo = '__DIE__'; $SIG{$foo} = &foo; Regular expressions are identified by values beginning and ending with slashes. Any variable with a name that matches "m/pattern/sm" will be forbidden. For example: [Variables::ProhibitEvilVariables] variables = /acme/ would cause all variables that match "m/acme/" to be forbidden. If you want a case-blind check, you can use (?i: ... ). For example [Variables::ProhibitEvilVariables] variables = /(?i:acme)/ forbids variables that match "m/acme/smi". In addition, you can override the default message ("Prohibited variable "variable" used") with your own, in order to give suggestions for alternative action. To do so, put your message in curly braces after the variable name or regular expression. Like this: [Variables::ProhibitEvilVariables] variables = $[ {Found use of $[. Program to base index 0 instead} If your message contains curly braces, you can enclose it in parentheses, angle brackets, or square brackets instead. Similarly, the "variables_file" option gives the name of a file containing specifications for prohibited variables. Only one variable specification is allowed per line and comments start with an octothorp and run to end of line; no curly braces are necessary for delimiting messages: $[ # Prohibit the "$[" variable and use the default message. # Prohibit the "$^S" variable and give a replacement message. $^S Having to think about $^S in exception handlers is just wrong # Use a regular expression. /acme/ No coyotes allowed. By default, there are no prohibited variables, although I can think of a few that should be. See "perldoc perlvar" for a few suggestions. RESTRICTIONS
Variables of the form "${^foo}" are not recognized by PPI as of version 1.206. When PPI recognizes these, this policy will Just Work for them too. Only direct references to prohibited variables and literal subscripts will be recognized. For example, if you prohibit $[, the first line in my $foo = $[; $$foo = 1; will be flagged as a violation, but not the second, even though the second, in fact, assigns to $[. Similarly, if you prohibit $SIG{__DIE__}, this policy will not recognize my $foo = '__DIE__'; $SIG{$foo} = sub {warn 'I cannot die!'}; as an assignment to $SIG{__DIE__}. NOTES
This policy leans heavily on Perl::Critic::Policy::Modules::ProhibitEvilModules by Jeffrey Ryan Thalhammer. AUTHOR
Thomas R. Wyant, III wyant at cpan dot org COPYRIGHT
Copyright (c) 2009-2011 Thomas R. Wyant, III 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::Variables::ProhibitEvilVariables(3pm)
All times are GMT -4. The time now is 07:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy