03-02-2006
Combine file
Hi all,
If I have 4 kind of files , and each file have different date, all of them are flat file and have the same 4 fields
Date|ID|Class|City
english.20060228.dat
02/28/2006|ABC|ENG|San Tomas
02/28/2006|BCD|ENG|San Jone
02/28/2006|AFD|ENG|San Luis
02/28/2006|ADD|ENG|San Mateo
english.20060227.dat
02/27/2006|ABC|MTH|San Tomas
02/27/2006|BBD|ENG|San Jone
02/27/2006|HFD|ENG|San Luis
02/27/2006|RRR|PHY|San Mateo
Spanish.20060228.dat
02/28/2006|AXC|ENG|San Tomas
02/28/2006|BXD|ENG|San Jone
02/28/2006|AXD|ENG|San Luis
02/28/2006|AXD|ENG|San Mateo
Spanish.20060227.dat
02/27/2006|ANC|SPASan Tomas
02/27/2006|BND|HUH|San Jone
02/27/2006|AND|WEL|San Luis
02/27/2006|AND|TET|San Mateo
france.20060228.dat
02/28/2006|AMC|EWW|San Tomas
02/28/2006|BMD|WRE|San Jone
02/28/2006|AMD|RGG|San Luis
02/28/2006|AMD|EWW|San Mateo
france.20060227.dat
02/27/2006|QYQ|MTH|San Tomas
02/27/2006|BYD|ENG|San Jone
02/27/2006|AYD|ENG|San Luis
02/27/2006|AYD|PHY|San Mateo
Dummy.20060228.dat
02/28/2006|AKC|ENGD|San Tomas
02/28/2006|BKD|ENGD|San Jone
02/28/2006|AKD|ENGD|San Luis
02/28/2006|AKD|ENGD|San Mateo
Dummy.20060227.dat
02/27/2006|AIC|MTHD2|San Tomas
02/27/2006|BID|ENGD2|San Jone
02/27/2006|AID|ENGD2|San Luis
02/27/2006|AID|PHYD2|San Mateo
how do I write a code to combine all file english*.dat , spanish*.dat , france*.dat NOT DUMMY.dat and it should have combine.date.log and combine.date2.log ( and new containt sort by ID and CLASS).... like combine.20060227.log , combine.20060228.log
How it can go to this directory and do in one script ??
can we do it in korn shell ?
Thanks
Last edited by sabercats; 03-02-2006 at 04:54 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Friends,
Is it possible in Unix ?
The requirement is
=============
Create a unix shellscript that combines multiple excel files into one.
Note : it is possible for data files.but the requirement is for excel file (4 Replies)
Discussion started by: bikas_jena
4 Replies
2. Shell Programming and Scripting
Hi Guys,
I have a file as follows:
1 2 3
There are 5 spaces between 1 and 2 and one space between 2 and 3.
I want:
123
How can I do this using awk?
I tried using: (8 Replies)
Discussion started by: npatwardhan
8 Replies
3. UNIX for Dummies Questions & Answers
I tried to put the history line number and the date into the file with one command, and failed. Can't figure out how to get the date variable substituted for the last space captured.
history | tail -1 | sed -e 's/.\{7\}/&/g' | head -1 | sed 's/ $/$date/'
Result was:
729 $date
So, I... (8 Replies)
Discussion started by: jimbob75
8 Replies
4. Shell Programming and Scripting
Hi, can anybody help me.
I want to combine these two file into one horizontally.
1st File:
...
10:00
10:01
10:02
10:03
10:04
10:05
...
2nd File:
...
0715 10:00 Caps: 50
0715 10:01 Caps: 65
0715 10:02 Caps: 75
0715 10:04 Caps: 50
0715 10:05 Caps: 87 (3 Replies)
Discussion started by: lurak
3 Replies
5. Shell Programming and Scripting
Below are the list of files I have
I want to consolidate the monthly log in the one file
Eg : all the july log to be moved to log_july_full.txt inside the script
Path : /home/user/data/log/
Jun 6 04:08 data_log-2010.05.30-10:04:08.txt
Jun 13 01:38 data_log-2010.06.06-10:04:08.txt... (3 Replies)
Discussion started by: mail2sant
3 Replies
6. Shell Programming and Scripting
Can you guys help me, I have two files:
File A
60|11111|
601|11111|
6012|11111|
6013|11111|
60142|11111|
File B
642|11111|
659|11111|
852|11111|
6012|11111|
6013|11111|
I want to combine the two file into:
File C
60|642|
601|642|
6012|642| (2 Replies)
Discussion started by: lurak
2 Replies
7. Shell Programming and Scripting
I have 2 files: phone.txt and mobile.txt
ex. phone.txt
MOBILENO|DISABLE_DATE
919687877754|9/1/2011|
919687877762|9/1/2011|
919687880573|9/1/2011|
919687882658|9/2/2011|
Ex. mobile.txt
MOBILENO |TIME
919687880573|2011-09-17 12:23:40|
919687882658|2011-10-10 21:15:33|... (4 Replies)
Discussion started by: khingx
4 Replies
8. Shell Programming and Scripting
Hello All,
I have a file like this
APPLY
( 'INSERT INTO brdcst_media_cntnt (
cntnt_id
,brdcst_media_cntnt_cd
,cntnt_prvdr_cd
,data_src_type_cd
,cntnt_titl_nm
,cntnt_desc
,batch_dt
,batch_id
) VALUES
(
:cntnt_id (3 Replies)
Discussion started by: nnani
3 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I have a requirement where I need to combine two lines in a file based on first character of each line in a file.
Please find the sample content of the file below:
Code:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi,... (1 Reply)
Discussion started by: jayaP
1 Replies
10. UNIX for Advanced & Expert Users
Hi,
I have a requirement where I need to combine two lines in a file based on first character of each line in a file.
Please find the sample content of the file below:
Code:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi,... (1 Reply)
Discussion started by: jayaP
1 Replies
LEARN ABOUT DEBIAN
class::dbi::plugin::retrieveall
Class::DBI::Plugin::RetrieveAll(3pm) User Contributed Perl Documentation Class::DBI::Plugin::RetrieveAll(3pm)
NAME
Class::DBI::Plugin::RetrieveAll - more complex retrieve_all() for Class::DBI
SYNOPSIS
use base 'Class::DBI';
use Class::DBI::Plugin::RetrieveAll;
my @by_date = My::Class->retrieve_all_sorted_by("date");
# or
__PACKAGE__->retrieve_all_sort_field('date');
my @by_date = My::Class->retrieve_all;
DESCRIPTION
This is a simple plugin to a Class::DBI subclass that allows for simple sorting of the results of a retrieve_all().
There are two main ways to use this.
Firstly, we create a new method 'retrieve_all_sorted_by' which takes an argument of how to sort.
We also add a method for 'retrieve_all_sort_field' that sets a default field that any retrieve_all() will use for sorting.
METHODS
retrieve_all_sorted_by
my @by_date = My::Class->retrieve_all_sorted_by("date");
This method will be exported into the calling class, and allows for retrieving all the objects of the class, sorted by the given column.
The argument given will be passed straight through to the database 'as is', and is not checked in any way, so an error here will usually in
an error from the database, rather than Class::DBI itself.
This makes it possible to pass more complex ORDER BY clauses through:
my @by_date = My::Class->retrieve_all_sorted_by("date DESC, reference_no");
retrieve_all_sort_field
__PACKAGE__->retrieve_all_sort_field('date');
This method changes the default retrieve_all() in the Class to be auto-sorted by the field given. Again this will be passed through
directly, so you can have complex ORDER BY clauses.
AUTHOR
Tony Bowden
BUGS and QUERIES
Please direct all correspondence regarding this module to:
bug-Class-DBI-Plugin-RetrieveAll@rt.cpan.org
COPYRIGHT and LICENSE
Copyright (C) 2004-2006 Kasei. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.0 2006-01-16 Class::DBI::Plugin::RetrieveAll(3pm)