Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Changing file content based on file header Post 302492154 by Fahmida on Sunday 30th of January 2011 05:51:33 AM
Old 01-30-2011
Changing file content based on file header

Hi,

I have several text files each containing some data as shown below:

File1.txt
HTML Code:
>DataHeader
Data...
Data...
File2.txt
HTML Code:
>DataHeader
Data...
Data...
etc.
What I want is to change the 'DataHeader' based on the file name. So the output should look like:
File1.txt
HTML Code:
 >File1
 Data...
 Data...
File2.txt
HTML Code:
>File2
 Data...
 Data...
Is there any unix command or shortcut to do that?
Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Reading a file and sending mail based on content of the file

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

2. Shell Programming and Scripting

Help with rename header content based on reference file problem

I got long list of reference file >data_tmp_number_22 >data_tmp_number_12 >data_tmp_number_20 . . Input file: >sample_data_1 Math, 5, USA, tmp SDFEWRWERWERWRWER FSFDSFSDFSDGSDGSD >sample_data_2 Math, 15, UK, tmp FDSFSDFF >sample_data_3 Math, 50, USA, tmp ARQERREQR . . Desired... (7 Replies)
Discussion started by: perl_beginner
7 Replies

3. Shell Programming and Scripting

Remove the file content based on the Header of the file

Hi All, I want to remove the content based on the header information . Please find the example below. File1.txt Name|Last|First|Location|DepId|Depname|DepLoc naga|rr|tion|hyd|1|wer|opr Nava|ra|tin|gen|2|wera|opra I have to search for the DepId and remove the data from the... (5 Replies)
Discussion started by: i150371485
5 Replies

4. Shell Programming and Scripting

substitution of fields based on header from another file

I have two files File1 with position (chromosome:start) and individuals as header, where pos is something like 1:2000 and every individual has a value. I have many columns and rows, here an example (tab separated): pos ind1 ind2 ind3 indn... 1:2000 0 0.1 0.1 1 1:2500 0.99 0.2 0.1 0.2 2:1000... (2 Replies)
Discussion started by: kuin
2 Replies

5. Shell Programming and Scripting

Shell Script to Dynamically Extract file content based on Parameters from a pdf file

Hi Guru's, I am new to shell scripting. I have a unique requirement: The system generates a single pdf(/tmp/ABC.pdf) file with Invoices for Multiple Customers, the format is something like this: Page1 >> Customer 1 >>Invoice1 + invoice 2 >> Page1 end Page2 >> Customer 2 >>Invoice 3 + Invoice 4... (3 Replies)
Discussion started by: DIps
3 Replies

6. Shell Programming and Scripting

Print the column content based on the header

i have a input of csv file as below but the sequence of column get changed. I,e it is not necessary that name comes first then age and rest all, it may vary. name,age,marks,roll,section kevin,25,80,456,A Satch,23,56,789,B Meena,24,78,H245,C So i want to print that column entires which... (12 Replies)
Discussion started by: millan
12 Replies

7. Shell Programming and Scripting

Changing file content in perl

Hi All, I have a file content like this. #<clear_category_list> #<include file="SUITE:Provision-FLEXPONDER_FAC.inc"> #<include file="CAT:SYSTEM:SAS_U23.inc"> #<include file="CAT:PRIORITY:10.inc"> #<include file="CAT:FAC_TYPE:OC48.inc"> #<include file="CAT:FAC_TYPE:OC192.inc">... (2 Replies)
Discussion started by: Syed Imran
2 Replies

8. Shell Programming and Scripting

Split a file based on encountering header

I need to split a file based on headers found Input file file1 content: ADD john mickey DROP matt sam output of file F1 john mickey output of file F2 matt sam (5 Replies)
Discussion started by: Diddy
5 Replies

9. Shell Programming and Scripting

Find columns in a file based on header and print to new file

Hello, I have to fish out some specific columns from a file based on the header value. I have the list of columns I need in a different file. I thought I could read in the list of headers I need, # file with header names of required columns in required order headers_file=$2 # read contents... (11 Replies)
Discussion started by: LMHmedchem
11 Replies

10. Shell Programming and Scripting

How to create file and file content based existing information?

Hi Gurus, I am SQL developer and new unix user. I need to create some file and file content based on information in two files. I have one file contains basic information below file1 and another exception file file2. the rule is if "zone' and "cd" in file1 exists in file2, then file name is... (13 Replies)
Discussion started by: Torhong
13 Replies
Chart::Clicker::Data::Series(3pm)			User Contributed Perl Documentation			 Chart::Clicker::Data::Series(3pm)

NAME
Chart::Clicker::Data::Series - A series of key, value pairs representing chart data VERSION
version 2.83 SYNOPSIS
use Chart::Clicker::Data::Series; my @keys = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9); my $series = Chart::Clicker::Data::Series->new({ keys => @keys, value => @values }); # Alternately, if you prefer my $series2 = Chart::Clicker::Data::Series->new({ 1 => 42, 2 => 25, 3 => 85, 4 => 23, 5 => 2, 6 => 19, 7 => 102, 8 => 12, 9 => 54, 10 => 9 }); DESCRIPTION
Chart::Clicker::Data::Series represents a series of values to be charted. Despite the name (keys and values) it is expected that all keys and values will be numeric. Values is pretty obvious, but it is important that keys also be numeric, as otherwise we'd have no idea how to order the data. If you want to use text labels for your domain's see Chart::Clicker::Axis's tick_labels method. ATTRIBUTES
keys Set/Get the keys for this series. add_to_keys Adds a key to this series. name Set/Get the name for this Series range Returns the range for this series. values Set/Get the values for this series. METHODS
key_count Get the count of keys in this series. add_to_values Add a value to this series. value_count Get the count of values in this series. add_pair ($key, $value) Convenience method to add a single key and a single value to the series. get_value_for_key ($key) Returns the value associated with the specified key. This is necessary because not all series will have values for every key. 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::Data::Series(3pm)
All times are GMT -4. The time now is 05:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy