Sponsored Content
Full Discussion: reading file awk or while
Top Forums Shell Programming and Scripting reading file awk or while Post 302682663 by vgersh99 on Monday 6th of August 2012 04:15:02 PM
Old 08-06-2012
Code:
awk '
  $1=="Name" {n=$NF;nc=0;print n;next}
  $1=="NOS" { print ((nc)?"APPEND":"INSERT") "-name mdt" n " -nos " $3 " to chart ABC;"; nc++}' myFile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading large file, awk and cut

Hello all, I have 2 files, the first (indexFile1) contains start offset and length for each record inside the second file. The second file can be very large, each actual record start offset and length is defined by the entry in indexFile1. Since there are no records separators wc-l returns 0 for... (1 Reply)
Discussion started by: gio001
1 Replies

2. Shell Programming and Scripting

Using awk to when reading a file to search and output to file

Hi, I am not sure if this will work or not. I am getting a syntax error. I am reading fileA, using an acct number field trying to see if it exists in fileB and output to new file. Can anyone tell me if what I am doing will work or should I attempt it another way? Thanks. exec < "${fileA}... (4 Replies)
Discussion started by: ski
4 Replies

3. Shell Programming and Scripting

Reading a file several times with awk

Hi everyone, I was wondering if it's possible to read a file ("file2" in my example) more than once. In this example I want to print file2 entirely for each lines of file1: awk -F$'\t' '{ print $0 while ((getline < "file2") > 0) { print "\t"$0 } }' file1 It... (4 Replies)
Discussion started by: anthony.cros
4 Replies

4. Shell Programming and Scripting

awk- reading input file twice

Hello, I've been trying to come up with a solution for the following problem; I have an input file with two columns and I want to print as an output the first column without any changes but for the second column, I want to divide it by its last value. Example input: 1 9 2 10 3 11 4 12 5... (14 Replies)
Discussion started by: acsg
14 Replies

5. Shell Programming and Scripting

awk file reading doubt

Hi, Using this trivial code, I am trying to insert/paste the single column data of a file into the second column (field 2) of a multi-column text file. awk 'FNR==NR {a=$0; next} {$1=$1 OFS a}1' single-column-file multi-column-file Lets consider the single-column-file as 'f2' and multi-column... (1 Reply)
Discussion started by: royalibrahim
1 Replies

6. Shell Programming and Scripting

AWK/Shell script for reading text file

Hello, I have a text file which has list of SQL Commands, from where I have grepped the lines where there is a specific string: grep <string> <file1> >> <file2> A sample of the file2 is: INSERT INTO PS_PWC_SP_ERN_DATA SELECT A.EMPLID ,B.COMPANY ,B.PAYGROUP , B.OTH_PAY FROM... (7 Replies)
Discussion started by: suddhasatwa_bha
7 Replies

7. Shell Programming and Scripting

awk - sed / reading from a data file and doing algebraic operations

Hi everyone, I am trying to write a bash script which reads a data file and does some algebraic operations. here is the structure of data.xml file that I have; 1 <data> 2 . 3 . 4 . 5 </data> 6 <data> 7 . 8 . 9 . 10</data> etc. Each data block contains same number of lines (say... (4 Replies)
Discussion started by: hayreter
4 Replies

8. Shell Programming and Scripting

awk issue while reading from file in while do

Hi Friends, I am trying to scan line by line using awk and pull the values and pass it in variables and then will use the variables but doesn't work. Please see below for details. #more dbtest.sh ---------------------------------- #!/bin/bash . $HOME/.bash_profile while read line do... (6 Replies)
Discussion started by: narunice
6 Replies

9. Shell Programming and Scripting

Reading data from file using awk

I have a file as below. It contains two data sets separated by >. I want to pipe each data set to another program called psxy. How can I get the different records Have started doing as follows but it only passes the first data set awk 'BEGIN {RS=">"};{print $0}' p.dat cat p.dat... (12 Replies)
Discussion started by: kristinu
12 Replies

10. Shell Programming and Scripting

Issues in reading file using 'awk'

Dear all, I am using following function of some script to assign variable "JobNo" some value form file $SAMPLE"_status.log" ( generated using the red color command ) crab ntuplize_crab -status -c $SAMPLE >& $SAMPLE"_status.log" & echo $SAMPLE"_status.log" "=====" jobNo=$(awk... (10 Replies)
Discussion started by: emily
10 Replies
Spreadsheet::WriteExcel::Chart::Pie(3pm)		User Contributed Perl Documentation		  Spreadsheet::WriteExcel::Chart::Pie(3pm)

NAME
Pie - A writer class for Excel Pie charts. SYNOPSIS
To create a simple Excel file with a Pie chart using Spreadsheet::WriteExcel: #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new( 'chart.xls' ); my $worksheet = $workbook->add_worksheet(); my $chart = $workbook->add_chart( type => 'pie' ); # Configure the chart. $chart->add_series( categories => '=Sheet1!$A$2:$A$7', values => '=Sheet1!$B$2:$B$7', ); # Add the worksheet data the chart refers to. my $data = [ [ 'Category', 2, 3, 4, 5, 6, 7 ], [ 'Value', 1, 4, 5, 2, 1, 5 ], ]; $worksheet->write( 'A1', $data ); __END__ DESCRIPTION
This module implements Pie charts for Spreadsheet::WriteExcel. The chart object is created via the Workbook "add_chart()" method: my $chart = $workbook->add_chart( type => 'pie' ); Once the object is created it can be configured via the following methods that are common to all chart classes: $chart->add_series(); $chart->set_title(); These methods are explained in detail in Spreadsheet::WriteExcel::Chart. Class specific methods or settings, if any, are explained below. Pie Chart Methods There aren't currently any pie chart specific methods. See the TODO section of Spreadsheet::WriteExcel::Chart. A Pie chart doesn't have an X or Y axis so the following common chart methods are ignored. $chart->set_x_axis(); $chart->set_y_axis(); EXAMPLE
Here is a complete example that demonstrates most of the available features when creating a chart. #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new( 'chart_pie.xls' ); my $worksheet = $workbook->add_worksheet(); my $bold = $workbook->add_format( bold => 1 ); # Add the worksheet data that the charts will refer to. my $headings = [ 'Category', 'Values' ]; my $data = [ [ 'Apple', 'Cherry', 'Pecan' ], [ 60, 30, 10 ], ]; $worksheet->write( 'A1', $headings, $bold ); $worksheet->write( 'A2', $data ); # Create a new chart object. In this case an embedded chart. my $chart = $workbook->add_chart( type => 'pie', embedded => 1 ); # Configure the series. $chart->add_series( name => 'Pie sales data', categories => '=Sheet1!$A$2:$A$4', values => '=Sheet1!$B$2:$B$4', ); # Add a title. $chart->set_title( name => 'Popular Pie Types' ); # Insert the chart into the worksheet (with an offset). $worksheet->insert_chart( 'C2', $chart, 25, 10 ); __END__ AUTHOR
John McNamara jmcnamara@cpan.org COPYRIGHT
Copyright MM-MMX, John McNamara. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. perl v5.10.1 2010-02-02 Spreadsheet::WriteExcel::Chart::Pie(3pm)
All times are GMT -4. The time now is 06:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy