Visit Our UNIX and Linux User Community


Keeping the title of a text report


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Keeping the title of a text report
# 1  
Old 11-02-2009
Keeping the title of a text report

I am in need of keeping a title of a report and removing duplicates from a file like the one below. I will be using the `uniq –u` command for the removal of duplicate lines (let me know if there is a better way rather than the command `uniq`) but I need to keep the title (first 9 lines) of the file. The file will be changing as we receive this raw data, but there will always be a title on each report. Any assistance would be greatly appreciated.

File example:
-----------------------------------------------
Code:
            Well Data Export
Project             :  RAW_DATA_EXTRACT
Cartographic System :  USA_TM20 N2
Depth Mode          :  E_20T
Depth Unit          :  International meters
Distance Unit       :  meters
Format File         :  TD_Curve_Ext.wlx
Date                :  Thu Oct 1 01:56:40 2009

TDP1       1AB0118Z_09507W45
TDP2          01-18-0394
TDP3       fyp_1000m_MMR_5D                 
TDP4
TDP5        0.0000       0.0000
TDP5      592.5000     587.4800
TDP5      593.0000     587.4800
TDP5      593.5000     587.6580
TDP5      594.0000     588.0971
TDP5      594.5000     588.5361
TDP5      595.0000     588.9752
TDP5      595.0000     588.9752
TDP5      595.5000     589.4147
TDP5      596.0000     589.8496
TDP5      596.5000     590.2748
TDP5      596.5000     590.2748
TDP5      597.0000     590.6946


Last edited by vgersh99; 11-02-2009 at 12:56 PM.. Reason: code tags, please!
# 2  
Old 11-02-2009
Code:
uniq -u input > output

# 3  
Old 11-02-2009
Thanks - I should have realized it would be so easy.

Previous Thread | Next Thread
Test Your Knowledge in Computers #1002
Difficulty: Medium
During her lifetime, Grace Hopper was awarded over 100 honorary degrees from universities across the world for her work in computer science.
True or False?

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Newbie reports: some posts show only the title and bottom-of-page menu. No text in the middle!

When I try to look at some of the posts (like "Rookie Grandmother"), I see the thread title and the menu at the bottom, but not the text of the post in the middle. I can see ALL of the posts in the Recent menu, but NONE of the others. The screenshot I attached shows the situation. I just... (2 Replies)
Discussion started by: JRWoodward
2 Replies

2. Shell Programming and Scripting

Convert text between exact matching patterns to Title case

Hi Folks, I have a large text file with multiple similar patterns on each line like: blank">PATTERN1 some word PATTERN2 title=">PATTERN1 some word PATTERN2 blank">PATTERN1 another word PATTERN2 title=">PATTERN1 another word PATTERN2 blank">PATTERN1 one more time PATTERN2 title=">PATTERN1... (10 Replies)
Discussion started by: martinsmith
10 Replies

3. Shell Programming and Scripting

Need to sort text keeping first line always first

I have a file is created from standard output. I have put a leading space to force the first line to collate low vis a vis the rest of the lines. If I pass the entire file to the Linux sort, it ignores the leading space and the first line appears in somewhere in the list. If I add lots of... (15 Replies)
Discussion started by: lsatenstein
15 Replies

4. Shell Programming and Scripting

Create a report for client with a text data file

Hi, I am an amateur bash scriptwriter and I need to write a script which creates a report in a formatted, easy to read table-like that is displayed to standard output. The script has to export the followings: Process ID,User Name, Command Name,Priority..... Now I have a file that I can see all... (3 Replies)
Discussion started by: bashily
3 Replies

5. Shell Programming and Scripting

Keeping the number intact

Currently I have the following to separate the numeric values. However the decimal point get separated. ls -lrt *smp*.cmd | awk '{print $NF}' | sed 's/^.*\///' | sed 's/\(*\)/ & /g' As an example on the files n02-z30-dsr65-terr0.50-dc0.05-4x3smp.cmd... (8 Replies)
Discussion started by: kristinu
8 Replies

6. Shell Programming and Scripting

Keeping last part

Hello, Sorry for the poor tilte but I still don't know how to this. Here is my problem. I have to huge log file. In this log file I can know where is stored all my files. As I have to get a reporting of of files I only need to keep the file name but I don't know how to do it. I hope you... (5 Replies)
Discussion started by: Aswex
5 Replies

7. Shell Programming and Scripting

In PHP replacing text between TAGS & URI information in Title Tag

Hi, what I am trying to do in PHP, is to replace the Title. I need some of the URL information inside aswell depending on the domain. The title is always different so I need to store it in a variable, put the url info like described below in front of it. Here is an example how it should... (0 Replies)
Discussion started by: lowmaster
0 Replies

8. UNIX for Dummies Questions & Answers

house keeping script

Hi, I am not aware whether any one has posted this early or not. I am creating a house keeping script in which I give the user two options: 1. creating a zip file. 2. removing all files given by user. Before taking any action I am asking user to enter full path of file or files to be... (7 Replies)
Discussion started by: Rakesh Bhat
7 Replies

9. Solaris

keeping history of command

hi can anyone tell me how or where to set to enable history of command keyed in to be logged? so that it can be used or traced later. thanks (3 Replies)
Discussion started by: legato
3 Replies

10. Shell Programming and Scripting

Keeping the format ...

Hi all, Am trying to execute a loop but having some troubles... Files that will be query'd use the Julian date (eg: cpu032, cpu365) in their naming convention. I'm a little lost how to maintain the three character format of the numeric portion of the file name while cycling backwards(or... (13 Replies)
Discussion started by: Cameron
13 Replies

Featured Tech Videos