Sponsored Content
Full Discussion: To replace header name
Top Forums Shell Programming and Scripting To replace header name Post 302993046 by rohit_shinez on Monday 6th of March 2017 07:47:56 AM
Old 03-06-2017
To replace header name

Hi,

i am having below csv file with header names, i need to change the header with appending a string

Code:
test.csv

h1,h2,h3,h4

Ouptut

hi_h1,hi_h2,hi_h3,hi_h4

I have tried below but this will take time if i have 100 headers. Is there a way to simplify this
Code:
sed -e 's#h1#'hi_h1'#g'  -e 's#h2#'hi_h2'#g' test.csv

 

10 More Discussions You Might Find Interesting

1. Linux

Reading the header of a tar file(posix header)

say i have these many file in a directory named exam. 1)/exam/newfolder/link.txt. 2)/exam/newfolder1/ and i create a tar say exam.tar well the problem is, when i read the tar file i dont find any metadata about the directories,as you cannot create a tar containig empty directories. on the... (2 Replies)
Discussion started by: Tanvirk
2 Replies

2. Shell Programming and Scripting

awk/sed column replace using column header - help

$ cat log.txt Name Age Sex Lcation nfld alias xsd CC 25 M XYZ asx KK Y BB 21 F XAS awe SS N SD 21 M AQW rty SD A How can I replace the column with header "Lcation" with the column with header "alias" and delete the "alias" column? so that the final output will become: Name Age Sex... (10 Replies)
Discussion started by: jkl_jkl
10 Replies

3. Shell Programming and Scripting

Header Replace characters

Hi, I have a flat file with header with tab delimiter. nbr id name salesid detail num source num jun_2007 jul_2007 aug_2007 sep_2007 ....feb_2008 I need to modify the header for the columns nbr to Id1 jun_2007 to Jun07 jul_2007 to Jul07 aug_2007 to Aug07 sep_2007 to Sep07... (3 Replies)
Discussion started by: umathurumella
3 Replies

4. Shell Programming and Scripting

improve performance - replace $\| with $#@ and remove header and trailer records

Hi All, In my file i need to remove header and trailer records which comes in 1st line and last line respectively. After that i need to replace '$\|' with '$#@'. I am using sed command for this and its taking lot of time. Is there any other command which can be used to improve performance? ... (1 Reply)
Discussion started by: HemaV
1 Replies

5. UNIX for Dummies Questions & Answers

Merge all csv files in one folder considering only 1 header row and ignoring header of all others

Friends, I need help with the following in UNIX. Merge all csv files in one folder considering only 1 header row and ignoring header of all other files. FYI - All files are in same format and contains same headers. Thank you (4 Replies)
Discussion started by: Shiny_Roy
4 Replies

6. Shell Programming and Scripting

Add column header and row header

Hi, I have an input like this 1 2 3 4 2 3 4 5 4 5 6 7 I would like to count the no. of columns and print a header with a prefix "Col". I would also like to count the no. of rows and print as first column with each line number with a prefix "Row" So, my output would be ... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

7. Shell Programming and Scripting

Replace a column with a value by ignoring the header lines

i have a file in the gz format , the content of the file is as follow. gzcat f1.gz # 1.name # 2.location # 3.age # 4.dob . . . . . . . . . # 43.hobbies < Aravind,33,chennai,09091980, , , , , , , surfing> (5 Replies)
Discussion started by: aravindj80
5 Replies

8. UNIX for Beginners Questions & Answers

awk script to extract a column, replace one of the header and replace year(from ddmmyy to yyyy)

I have a csv which has lot of columns . I was looking for an awk script which would extract a column twice. for the first occurance the header and data needs to be intact but for the second occurance i want to replace the header name since it a duplicate and extract year value which is in ddmmyy... (10 Replies)
Discussion started by: Kunalcurious
10 Replies

9. Shell Programming and Scripting

Find header in a text file and prepend it to all lines until another header is found

I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty. I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
3 Replies

10. Shell Programming and Scripting

Bash script - How to update header of scripts in one pass - multiline search/replace

Hello. A find command return a list of file. For each fileReplace the content starting with the first "§" (of two) ending with last "ɸ" (of two), regardless of the content ( five lines ) by the following content (exactly) : §2019_08_23§ # # ... (8 Replies)
Discussion started by: jcdole
8 Replies
Chart::Clicker::Decoration::Legend::Tabular(3pm)	User Contributed Perl Documentation	  Chart::Clicker::Decoration::Legend::Tabular(3pm)

NAME
Chart::Clicker::Decoration::Legend::Tabular - Tabular version of Legend VERSION
version 2.83 SYNOPSIS
my $cc = Chart::Clicker->new; my $series1 = Chart::Clicker::Data::Series->new; my $series2 = Chart::Clicker::Data::Series->new; $cc->legend(Chart::Clicker::Decoration::Legend::Tabular->new( header => [ qw(Name Min Max) ], data => [ [ min(@{ $series1->values }), max(@{ $series1->values }) ], [ min(@{ $series2->values }), max(@{ $series2->values }) ] ] )); DESCRIPTION
Chart::Clicker::Decoration::Legend::Tabular draws a legend on a Chart with tabular data display. The Tabular legend is a legend with a few extra attributes that allow you to pass it data to display. The attributes are c<header> and c<data>. The "header" (optional) allows you to specify the strings to display at the top of the table and the "data" attribute allows you to pass in arrayrefs of strings for display aside each of the series. Note: The first string in the "header" arrayref should be the header for the column above the name of the series. This code does not do anything to verify that you've given the appropriate counts of data. It is expected that you will provide "data" with one arrayref for every series, each containing n elements. Having that, "header" will expect n + 1 elements with one for the series name and the remaining (n) matching the number of elements in each of "data"'s arrayrefs. ATTRIBUTES
border Set/Get this Legend's border. color Set/Get the color to use as the foreground for the legend. data Set/Get the data for this legend. Expects an arrayref of arrayrefs, with one inner arrayref for every series charted. font Set/Get the font used for this legend's items. header Set/Get the header data used for this legend. Expects an arrayref of Strings. insets Set/Get this Legend's insets. item_padding Set/Get the padding for this legend's items. METHODS
has_header Predicate returning true of this legend has a header, else 1. AUTHOR
Cory G Watson <gphat@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Cold Hard Code, LLC. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-22 Chart::Clicker::Decoration::Legend::Tabular(3pm)
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy