Need-To remove header/trailor and add-date-on first-postion-plz-help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need-To remove header/trailor and add-date-on first-postion-plz-help
# 1  
Old 10-06-2010
Need-To remove header/trailor and add-date-on first-postion-plz-help

Hi Friends thanks a lot....for ur replies its worked fine...i have one more question..
if i need to remove trailor (T000000004 ) as shown below file also with header.Plz help thanks
Source file:
H20100928
D04041201609360677PC790010384I
D04041203326357853PC790010645R
D04041203602983265PC790010740R
D04041208423493600PC790011258I
T000000004


Output File should be as :
20100928D04041201609360677PC790010384I
20100928D04041203326357853PC790010645R
20100928D04041203602983265PC790010740R
20100928D04041208423493600PC790011258I


Moderator's Comments:
Mod Comment It's the same question to asked here. And please start using code tags, thank you.

Last edited by Scott; 10-06-2010 at 11:41 AM.. Reason: Double post
# 2  
Old 10-06-2010
Code:
sed -e '1d;$d' -e "s/^/$(date +%Y%m%d)/" infile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove files having 0 byte or only header

Hi Team, I'm looking for a command which removes files having 0 byte of having only header line (1 line). My ETL process generates these files. Few files are not having header, in that case if no data from source, it will be 0 byte and few files are having header, in that case if no data from... (7 Replies)
Discussion started by: ace_friends22
7 Replies

2. Shell Programming and Scripting

Plz Help in sorting the data on date basis

I have file a.txt having below data cat a.txt 01-MAY-13 2.38.11.00.100089 IN 4512 0000741881 01-JUN-13 2.38.11.00.100089 IN 1514 0000764631 01-NOV-13 2.38.11.00.100089 IN 1514 0000856571 01-NOV-13 2.38.15.00.100015 IN 300.32 0000856531 01-JUN-13 2.38.19.00.100000 IN 2698 0000764493... (5 Replies)
Discussion started by: ranabhavish
5 Replies

3. UNIX for Dummies Questions & Answers

Plz Help in sorting the data on date basis

I have file having below data 01-MAY-13 2.38.11.00.100089 IN 4512 0000741881 01-JUN-13 2.38.11.00.100089 IN 1514 0000764631 01-NOV-13 2.38.11.00.100089 IN 1514 0000856571 01-NOV-13 2.38.15.00.100015 IN 300.32 0000856531 01-JUN-13 2.38.19.00.100000 IN 2698 0000764493 01-JUL-13... (2 Replies)
Discussion started by: ranabhavish
2 Replies

4. 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

5. Programming

[solved] how to remove header and footer

it still display header and footer header SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 24 13:41:51 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real... (0 Replies)
Discussion started by: ment0smintz
0 Replies

6. UNIX for Dummies Questions & Answers

remove the header and footer using sed

I want to delete the header and footer in the file by using sed for that i ran the below script and my text file looks like emp.txt # This file contain employee # information abc 12300 34 'FGH' # This is confidential as per the firm rules. my intention is to remove the header... (8 Replies)
Discussion started by: vmachava
8 Replies

7. Shell Programming and Scripting

Need to Add date on first position.Plz help

We have a file as shown below with Header and details below Header.Here Header indicates date field. i Want to add date i.e 20100928 as a first position as shown below without header.Please help us using unix script Source file: H20100928 D04041201609360677PC790010384I ... (17 Replies)
Discussion started by: dprakash
17 Replies

8. UNIX for Advanced & Expert Users

Friendz.. plz help me on this date function.

:confused: Hi there. Hi frndz, I have to script a shell in such a way that by giving the current date, it should give the previous saturday date and next sunday date as output. eg: Input - 01-01-2008 O/p - last saturady- 30-12-2007(ddmmyy) Next Sunday- 05-01-2008 ... (14 Replies)
Discussion started by: psn123
14 Replies

9. SCO

How to remove date and page header from a printout

I have some HP4+ and HP5 printers printing from Unixware 7.1.4. The problem is that they print a page header with the date and page number. I can't seem to figure out how to stop this. These headers through the pagination off. (2 Replies)
Discussion started by: sladeburke
2 Replies

10. Shell Programming and Scripting

remove header and footer rows

I would like to remove some lines from begining of file (header) and some lines from end of file (footer). The header/footer lines generated by web-browser when the user upload a file to my webserver. Example: -----------------------------7d62af20c052c Content-Disposition: form-data;... (2 Replies)
Discussion started by: seaky
2 Replies
Login or Register to Ask a Question