Create SSIS Import parsing based on text file...
I have a text file listing 500 field names and their lengths. (In a few months we will begin receiving monthly data files matching that schema). I can create an SSIS 2008 project and manually parse the columns (inside SSIS) to match that
schema but I wonder if there is an easier way to do what I want (e.g. if I created a table using t-sql commands could SSIS somehow "pickup" the SSIS parsing from the table schema?)
TIA,
edm2
Not exactly. What I was hoping for is that instead of pointing SSIS to the data file and manually parsing all the fields that I could create an (empty) table with the right schema and have SSIS use that table schema to define how it should
parse the input data. (Kind of backwards from the usual approach.)
edm2
Sorry you cant parse text file for metadata like that as metadata has to fixed in SSIS
However one way you can implement this is as follows
1. Create your table with required schema
2. In SSIS have a data flow task with flat file source which points to your file. Choose only a row delimiter and no column delimiter
3. Put a oledb destination and point to staging table with an identity column
4. Put a Execute SQL Task with query as below
SELECT CASE WHEN (SELECT Column FROM Staging WHERE IDCol=1) = STUFF((SELECT ',' + COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Your schema table name'
AND TABLE_SCHEMA = 'dbo'
FOR XML PATH('')),1,1,'')
THEN 0
ELSE 1
END AS SchemaDiff
FROM (SELECT 1)t
Then map SchemaDiff column in the resultset to a boolean variable created in ssis. Also make sure you set resultset option to single row
Then you can use this boolean variable to check if schema is same. If False means no difference in schema else there's difference.
just a caution thar this will only compare column details without comparing their datatypes,lengths etc
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
Similar Messages
-
Create and write form output to text file
HI am pretty new to this and have a prob.
I have 10 fields in my form submitting which i need to create and write the form field values into an xml fil..this file is further used for other read write transactions.
Can somebody help creating and writing data into the text file with code (if u have it handy).
Thanks for the help in anticipationFile f = new File("/path/to/output.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
String inputData = null;
while(true){
inputData = //whatever data you need
bw.write(inputData);
bw.flush();
bw.close();
f.close;
// All this should be in a try{}catch(IOException ioe){} -
How to import data from a text file into a table
Hello,
I need help with importing data from a .csv file with comma delimiter into a table.
I've been struggling to figure out how to use the "Import from Files" wizard in Oracle 10g web-base Enterprise Manager.
I have not been able to find a simple instruction on how to use the Wizard.
I have looked at the Oracle Database Utilities - Overview of Oracle Data Pump and the Help on the "Import: Files" page.
Neither one gave me enough instruction to be able to do the import successfully.
Using the "Import from file" wizard, I created a Directory Object using the Create Directory Object button. I Copied the file from which i needed to import the data into the Operating System Directory i had defined in the Create Directory Object page. I chose "Entire files" for the Import type.
Step 1 of 4 is the "Import:Re-Mapping" page, I have no idea what i need to do on this page. All i know i am not tying to import data that was in one schema into a different schema and I am not importing data that was in one tablespace into a different tablespace and i am not R-Mapping datafiles either. I am importing data from a csv file.
For step 2 of 4, "Import:Options" page, I selected the same directory object i had created.
For step 3 of 4, I entered a job name and a description and selected Start Immediately option.
What i noticed going through the wizard, the wizard never asked into which table do i want to import the data.
I submitted the job and I got ORA-31619 invalid dump file error.
I was sure that the wizard was going to fail when it never asked me into which table do i want to import the data.
I tried to use the "imp" utility in command-line window.
After I entered (imp), i was prompted for the username and the password and then the buffer size as soon as i entered the min buffer size I got the following error and the import was terminated:
C:\>imp
Import: Release 10.1.0.2.0 - Production on Fri Jul 9 12:56:11 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Username: user1
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Import file: EXPDAT.DMP > c:\securParms\securParms.csv
Enter insert buffer size (minimum is 8192) 30720> 8192
IMP-00037: Character set marker unknown
IMP-00000: Import terminated unsuccessfully
Please show me the easiest way to import a text file into a table. How complex could it be to do a simple import into a table using a text file?
We are testing our application against both an Oracle database and a MSSQLServer 2000 database.
I was able to import the data into a table in MSSQLServer database and I can say that anybody with no experience could easily do an export/import in MSSQLServer 2000.
I appreciate if someone could show me how to the import from a file into a table!
Thanks,
Mitra>
I can say that anybody with
no experience could easily do an export/import in
MSSQLServer 2000.
Anybody with no experience should not mess up my Oracle Databases ! -
How to do import data from the text file into the mathscript window?
Could anyone tell me how to do import data from text file into mathscript window for labview 8?
MathScript Window openned, File, Load Data - it has options: custom pattern (*.mlv) or all files.
ThanksHi Milan,
Prior to loading data in Mathscript Window , you have to save the data from the Mathscript window (the default extension of the file is .mlv but you can choose any extension). This means that you cannot load data from a text file that was not created using the Mathscript window.
Please let me know if you have any further questions regarding this issue.
Regards,
Ankita -
Importing special characters from text file
My project requires me to import a text file into a dynamic
text field by using the loadVariables() function. My problem is
that the text file contains a ampersign "&" . It seems that the
ampersign stops the rest of the text from being imported into my
flash movie. Is there a special character or escape character that
I can use to allow me to import the ampersign?
I've tried using the & and setting my dynamic text
field to HTML. No luck. Oh.. I'm using flash MX :(
Any ideas?Hey I've run into this problem and found the solution lies
with JavaScript which can read the text just fine and then parse it
back to Flash as escape characters:
//JavaScript code:
var origText = 'blah blah & then i did this & then
blah blah";
var newText = String(escape(origText).replace(new
RegExp('\\+', 'g'), '%2b'));
FlashWin.sendText(newText); // << this is a reference
to a flash window with ExternalInterface enabled
// end
However, I was using HttpRequest in JS to get my original
data. So this method is dependent on something other than Flash to
retrieve the original text (with ampersands).
I really hope they fix this bug in the future, it can drive
you nuts....
-Dan -
How to create Base Dimensions with MaxL and Text File?
Hi,
Doing a scratch rebuild of a cube every month. Don't want to have a 'dummy' outline with base dimensions to copy over every build. Instead want to build from text file somehow. Thus my plan is to: 1) Delete the existing app/db 2) Create a new blank app/db 3) Create the base dimensions in the outline via text file and 4) Build entire outline via a text file. I'm stuck on #3 how to get the 'base dimensions' built via text file. I need:
ACCOUNTS
PERIOD
VALUE
VIEWS
SCENARIO
CUSTOM4
YEAR
CUSTOM3
CUSTOM2
ENTITY
CUSTOM1
I see this MaxL, but it uses a 'rules file' and I never have built a rules file to create base dims so I'm confused if it's possible or not...
import database sample.basic dimensions
from data_file '/data/calcdat.txt'
using rules_file '/data/rulesfile.rul'
on error append to '/logs/dimbuild.log';We rebuild our Departments and Organization from an enterprise hierarchy master each week.
The way we implemented (what you call #3) was to not do #1 and #2, but to have a "destructive" load rule for each of these dimensions using a text file. (in the "Dimension Build Settings" for the load rule, select "Remove Unspecified" to make it destructive)
The text file just has the dimension name (parent) and any children we needed defined in a parent/child relationship. For instance
"Sales Departments" "0100-All Departments"
This essentially works the same as deleting the app because the destructive load rules will drop all the blocks of data that were unspecified.
Then we run our SQL load rule to build the rest of the dimensions from the Location Master.
We perform a level-0 export prior to this process, then reload the level-0 data and execute all the consolidation scripts to get the data back (now in a current enterprise defined hierarchy) -
Is there a way where i can parse a method, or conditional statement from a text file? Like lets say that i had the statement in Test.txt
if(X >= Y)
do something
}and X and Y are already defined in the java file, is there a way that i could parse it so that the java code invokes it, as if it were part of the java file?Here's a little Groovy demo:
import groovy.lang.GroovyShell;
* To run this demo,
* - download 'groovy-binary-1.5.5.zip': http://dist.groovy.codehaus.org/distributions/groovy-binary-1.5.5.zip
* - unzip, and add 'lib/groovy-all-1.5.5.jar' to your classpath
public class GroovyDemo {
public static void main(String[] args) throws Exception {
String script =
" if(X > Y) { \n"+
" return X+X \n"+
" } else { \n"+
" return Y/4 \n"+
" } \n";
System.out.println("script=\n"+script);
GroovyShell shell = new GroovyShell();
shell.setProperty("X", new Integer(10));
shell.setProperty("Y", new Integer(9));
Object value = shell.evaluate(script);
System.out.println("value="+value+", "+value.getClass());
shell.setProperty("X", new Integer(8));
value = shell.evaluate(script);
System.out.println("value="+value+", "+value.getClass());
/* output:
script=
if(X > Y) {
return X+X
} else {
return Y/4
value=20, class java.lang.Integer
value=2.25, class java.math.BigDecimal
*/ -
How to import data from a text file through DTS to Sql Server
Please don't mistake me as i'm a new comer to sql server,please help me.
how to import the data present in a plain text file through DTS into sql server and store the data in a temporary table.
How far the temporary table is stored in the database.
Please reply me as soon as possible.
Thank you viewers.>
I can say that anybody with
no experience could easily do an export/import in
MSSQLServer 2000.
Anybody with no experience should not mess up my Oracle Databases ! -
I have an InDesign tagged text file I've translated from .xml. I need to automate the following steps:
1 - access specific InDesign template (eg. ABC_template.ind)
2 - import tagged text file into InDesign
3 - autoflow text to END of document (normally around 3-5 pages)
4 - save document as either .ps or .pdf file
5 - where the input file stub name matches the output stub name (eg., OrigName.txt outputs as OrigName.pdf).
I would like to completely automate this whole process using JavaScript (because I don't know anyone that knows AppleScript). I've automated the first part using a perl script. I've been trying to find sample snipits of JavaScript that would do one or more of the items listed above, but am having a hard time finding what I need.
Please, I'm desperate!! Can any of you InDesign scripting guru's out there help me??
Thanks in advance!!
LindaDHi Linda,
I might be able to help you out. You can contact me by email (click on my user name for the address), or if you post your email here. -
Parse large (2GB) text file
Hi all,
I would like your expert tips on efficient ways (speed and memory considerations) for parsing large text files (~2GB) in Java.
Specifically, the text files in hand contain mobility traces that I need to process. Traces have a predefined format, and each trace is given on a new line in the text file.
To obtain the attribues of each trace i use java.util.regex.Pattern and java.util.regex.Matcher.
Thanks in advance,
NickMemory mapped files are faster when you need random access and you don't need to load all the data, however here it just add complexity you don't need IMHO.
I suspect most of the time is taken by the parser so if you customise your parser it could be faster. Here is a simple custom parser
public static void main(String... args) throws IOException {
String template = "tr at %.1f \"$obj(1) pos 123.20 270.98 0.0 2.4\"%n";
File file = new File("/tmp/deleteme.txt");
// if(!file.exists()) {
System.out.println(new Date()+": Writing to "+file);
PrintWriter pw = new PrintWriter(file);
for(int i=0;i<Integer.MAX_VALUE/template.length();i++)
pw.printf(template, i/10.0);
pw.close();
System.out.println(new Date()+": ... finished writing to " + file + " length= " + file.length() / 1024 / 1024 + " MB.");
long start = System.nanoTime();
final BufferedReader br = new BufferedReader(new FileReader(file), 64 * 1024);
for(String line;(line = br.readLine()) != null;) {
int pos = 6;
int end = line.indexOf(' ', pos);
double time = Double.parseDouble(line.substring(pos, end));
pos = line.indexOf('s', end+12)+2;
end = line.indexOf(' ', pos+1);
double x = Double.parseDouble(line.substring(pos, end));
pos = end+1;
end = line.indexOf(' ', pos+1);
double y = Double.parseDouble(line.substring(pos, end));
pos = end+1;
end = line.indexOf(' ', pos+1);
double z = Double.parseDouble(line.substring(pos, end));
pos = end+1;
end = line.indexOf('"', pos+1);
double velocity = Double.parseDouble(line.substring(pos, end));
br.close();
long time = System.nanoTime() - start;
System.out.printf(new Date()+": Took %,f sec to read %s%n", time / 1e9, file.toString());
{code}
prints
{code}
Sun May 08 09:38:02 BST 2011: Writing to /tmp/deleteme.txt
Sun May 08 09:42:15 BST 2011: ... finished writing to /tmp/deleteme.txt length= 2208 MB.
Sun May 08 09:43:21 BST 2011: Took 66.610883 sec to read /tmp/deleteme.txt
{code} -
SSIS - how to break out text file into 1 meg files
I have a package that I need to split the output text files to 1 meg in size.
My package has a TsqL container that returns allot of records. I need the txt file output to create as many files as needed but none of them can be over 1 meg.
No idea how to do that..
qeqwreally? After reading it looks like it's more for balancing load..
the Balanced
Load Distributor allows me to predetermine/limit the output file size to 1 meg?
qeqw -
Importing space delimited iPad text files into number
Lots of iPad app collect data as space delimited text files ( where is tab key on iPad) how can I import these files into numbers for analysis and plotting?
Hi Wayne
In the posted datas, some dates end with a period but some don't.
Between values there are :
period (not always. None after the 1st date and after the one just above "no scale travel to Tucson")
space
Given the source which I used, I got different spaces.
In one case they were NO BREAK spaces
In the example which you posted, the first missing period is revealed
The second one isn't revealed because you didn't treated the entire set of datas.
I assume that when there are datas after the decimal values, they are supposed to be in a 3rd column.
Given these features, I wrote a script deciphering automatically the set of datas.
Adjust the property « fromClipboard » to match what you use as source.
--{code}
--[SCRIPT split-table-from-ipad]
Treat the set of datas imported from iPad by VerusEx
see Apple Discussions forum :
https://discussions.apple.com/thread/3879328?tstart=0
Yvan KOENIG (VALLAURIS, France)
2012/04/17
property fromClipboard : true
true = get datas from the clipboard
false : get the datas from a text file
on run
if fromClipboard then
set lesValeurs to the clipboard as text
else
set lesValeurs to read (choose file of type {"public.plain-text"})
end if
Instruction removing NO BREAK spaces which I got when I copied from the mail which I received from the forum.
set lesValeurs to my supprime(lesValeurs, character id 160)
Replace every groups of space characters by a single one
repeat
if lesValeurs does not contain " " then exit repeat
set lesValeurs to my remplace(lesValeurs, " ", space)
end repeat
Replace single digit + space by single digit + tab.
Useful to take care of cases when period is missing,
or to split strings stored after a digit + a space
repeat with i from 0 to 9
set lesValeurs to my remplace(lesValeurs, (i as text) & space, (i as text) & tab)
end repeat
Replace period + space by a tab
set lesValeurs to my remplace(lesValeurs, ". ", tab)
Save the deciphered datas in a temporary text file
set leFichier to (path to temporary items as text) & "azertyuiop.txt"
my writeTo(leFichier, lesValeurs, text, false)
Open the temporary file in Numbers
tell application "Numbers" to open leFichier
end run
--=====
replaces every occurences of d1 by d2 in the text t
on remplace(t, d1, d2)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d1
set l to text items of t
set AppleScript's text item delimiters to d2
set t to "" & l
set AppleScript's text item delimiters to oTIDs
return t
end remplace
--=====
removes every occurences of d in text t
on supprime(t, d)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end supprime
--=====
Handler borrowed to Regulus6633 - http://macscripter.net/viewtopic.php?id=36861
on writeTo(targetFile, theData, dataType, apendData)
-- targetFile is the path to the file you want to write
-- theData is the data you want in the file.
-- dataType is the data type of theData and it can be text, list, record etc.
-- apendData is true to append theData to the end of the current contents of the file or false to overwrite it
try
set targetFile to targetFile as text
set openFile to open for access file targetFile with write permission
if not apendData then set eof of openFile to 0
write theData to openFile starting at eof as dataType
close access openFile
return true
on error
try
close access file targetFile
end try
return false
end try
end writeTo
--=====
--[/SCRIPT]
--{code}
Yvan KOENIG (VALLAURIS, France) mardi 17 avril 2012
iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.3
My Box account is : http://www.box.com/s/00qnssoyeq2xvc22ra4k -
Importing data from a text file with MathScript
Hi,
I currently have a bit of Matlab code that imports a load of data from a tab-delimited text file. The text file is in the same directory as the .m file and my .vi file. The relevant line of import code from Matlab is:
data=dlmread('data.txt','\t',5,0);
When I run this in Labview after importing the code into a Mathscript block and connecting two relevant outputs to a "Build XY Graph" block such that the variables can be plotted, I get a message saying:
"Error -90001 occured at Error in function dlmread at line 10. Labview: File not found..."
How can I get LabVIEW to read the file? Sorry if this is a stupid question but I'm new to LabVIEW, having come from Matlab!
Thanks for the helpHi,
Looks like that you are using relative path. Then, the file must be located in MathScript search path. Otherwise, MathScript can not find that file. You can either specify the absolute path or add the path to MathScript search path list.
I have tried in LabVIEW 8.6. dlmread should work well to read data from .txt file. -
How can I create a Document object from a text file (myFile.txt)
Hi everybody:
Thank you for reading this message.
I am trying to find a method to convert a text file ( I have it in a File object) to a Document object.
I read the Java API but it is strange, I do not know if I have to create an AbstractDocument, it is really strange for me.
Any comment is welcome,
Regards,
JBDocument is an interface, and AbstractDocument is abstract, so you
can't create either of those directly. Assuming you are dealing with a
a plain text file, you could do something like
// Not catching any exceptions that get thrown
File file = /* file you already have */
String eol = System.getProperty( "line.separator" );
int eolLen = eol.length();
FileReader reader = new FileReader( file );
BufferedReader buffer = new BufferedReader( reader );
PlainDocument doc = new PlainDocument();
for ( String line = buffer.readLine() ; line != null ; line = buffer.readLine() ) {
int len = doc.getLength();
if ( len > 0 ) {
doc.insertString( len, eol, null );
len += eolLen;
doc.insertString( len, line, null );
}and now you have a document.
: jay -
Importing data from a text file into a table
Hi Experts,
I have the following flat file
weekly_eft_repo 1.0 Page: 1
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09 Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name Name on Bank Account Bank ABA Bank Acct On-line Amount Instant Amount Total Amount
======== ============================== ============================== ========== ==================== =============== =============== ===============
0200101 Triolet Popular Store Triolet Popular Store 111111111 62030100130659 10,868.00 0.00 10,868.00
0200103 Le Cacharel Snack Le Cacharel Snack 111111111 62030100130813 9,728.00 0.00 9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111 111111111 7,334.00 0.00 7,334.00
0200105 Chez Popo Supermarket Chez Popo Supermarket 111111111 61030100044898 30,932.00 0.00 30,932.00
0200106 Vana Supermarket Vana Supermarket 111111111 111111111 17,775.00 0.00 17,775.00
0200107 Mont Choisy Store Mont Choisy Store 111111111 62030100130804 8,840.00 0.00 8,840.00
0200108 Vijay Store Vijay Store 111111111 62030100131229 16,416.00 0.00 16,416.00
0200109 Neptune Confection Neptune Confection 111111111 62030100130931 11,077.00 0.00 11,077.00
0200110 Antoine Store Antoine Store 111111111 111111111 2,470.00 0.00 2,470.00
0200111 P.S.C Cold Storage P.S.C Cold Storage 111111111 111111111 10,431.00 0.00 10,431.00
0200113 Mini Prix Boutique Mini Prix Boutique 111111111 62030100131501 26,315.00 0.00 26,315.00
0200114 Hotel Cassim Hotel Cassim 111111111 111111111 135,147.00 0.00 135,147.00
0200116 Aman Snack Aman Snack 111111111 62030100129481 7,334.00 0.00 7,334.00
0200117 Best For Less Company Ltd Best For Less Company Ltd 111111111 111111111 3,325.00 0.00 3,325.00
0200118 Central Way Central Way 111111111 111111111 25,137.00 0.00 25,137.00I need to insert the data it contains into the following table
TABLE weekly_eft_report_temp
Name Null? Type
BILL_TO_RETAILER NOT NULL VARCHAR2(15)
RETAILER_NAME VARCHAR2(100)
NAME_ON_BANK_ACCOUNT VARCHAR2(100)
BANK_ABA VARCHAR2(1)
BANK_ACCT VARCHAR2(1)
ON_LINE_AMOUNT NUMBER
INSTANT_AMOUNT NUMBER
TOTAL_AMOUNT NUMBER Whats the easiest and best way to proceed on that?
Thanks
KevinI am with Chris on this one.
If those headers are repeating in your text file, you could run a simple script to cleanse the data first and make the file fit for SQL*Loader.
Here's an example with Perl, I hope the header of Page 2 and onwards resembles what you have in your file. I've snipped some data from the far right so that it fits on my terminal screen:
$
$ # show the contents of the data file
$
$ cat report.dat
weekly_eft_repo 1.0 Page: 1
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09 Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name Name on Bank Account Bank ABA Bank Acct On-line Amount
======== ============================== ============================== ========== ==================== ===============
0200101 Triolet Popular Store Triolet Popular Store 111111111 62030100130659 10,868.00
0200103 Le Cacharel Snack Le Cacharel Snack 111111111 62030100130813 9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111 111111111 7,334.00
0200105 Chez Popo Supermarket Chez Popo Supermarket 111111111 61030100044898 30,932.00
0200106 Vana Supermarket Vana Supermarket 111111111 111111111 17,775.00
weekly_eft_repo 1.0 Page: 2
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09 Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name Name on Bank Account Bank ABA Bank Acct On-line Amount
======== ============================== ============================== ========== ==================== ===============
0200107 Mont Choisy Store Mont Choisy Store 111111111 62030100130804 8,840.00
0200108 Vijay Store Vijay Store 111111111 62030100131229 16,416.00
0200109 Neptune Confection Neptune Confection 111111111 62030100130931 11,077.00
0200110 Antoine Store Antoine Store 111111111 111111111 2,470.00
0200111 P.S.C Cold Storage P.S.C Cold Storage 111111111 111111111 10,431.00
weekly_eft_repo 1.0 Page: 3
CDC:00304 / Sat Oct-31-2009 Weekly EFT Sweep for 25/10/09 - 31/10/09 Effective Date 03/11/09 Sat Oct-31-2009 22:06:14
Bill to
Retailer Retailer Name Name on Bank Account Bank ABA Bank Acct On-line Amount
======== ============================== ============================== ========== ==================== ===============
0200113 Mini Prix Boutique Mini Prix Boutique 111111111 62030100131501 26,315.00
0200114 Hotel Cassim Hotel Cassim 111111111 111111111 135,147.00
0200116 Aman Snack Aman Snack 111111111 62030100129481 7,334.00
0200117 Best For Less Company Ltd Best For Less Company Ltd 111111111 111111111 3,325.00
0200118 Central Way Central Way 111111111 111111111 25,137.00
$
$
$ # snip off the headers using Perl so that the transformed file has just the data to load
$
$ perl -lne 'BEGIN{$/=""} s/^weekly.*?=\n//msg; print' report.dat
0200101 Triolet Popular Store Triolet Popular Store 111111111 62030100130659 10,868.00
0200103 Le Cacharel Snack Le Cacharel Snack 111111111 62030100130813 9,728.00
0200104 Advanced Co-operative Self Ser Advanced Co-operative Self Ser 111111111 111111111 7,334.00
0200105 Chez Popo Supermarket Chez Popo Supermarket 111111111 61030100044898 30,932.00
0200106 Vana Supermarket Vana Supermarket 111111111 111111111 17,775.00
0200107 Mont Choisy Store Mont Choisy Store 111111111 62030100130804 8,840.00
0200108 Vijay Store Vijay Store 111111111 62030100131229 16,416.00
0200109 Neptune Confection Neptune Confection 111111111 62030100130931 11,077.00
0200110 Antoine Store Antoine Store 111111111 111111111 2,470.00
0200111 P.S.C Cold Storage P.S.C Cold Storage 111111111 111111111 10,431.00
0200113 Mini Prix Boutique Mini Prix Boutique 111111111 62030100131501 26,315.00
0200114 Hotel Cassim Hotel Cassim 111111111 111111111 135,147.00
0200116 Aman Snack Aman Snack 111111111 62030100129481 7,334.00
0200117 Best For Less Company Ltd Best For Less Company Ltd 111111111 111111111 3,325.00
0200118 Central Way Central Way 111111111 111111111 25,137.00
$
$ You could do an inline substitution with Perl, or redirect it to a temp file and then move back to the original file. In either case, you have just the relevant data for the next step.
Again, Perl is just one option. On Unix/Linux systems, you have a large number of utilities/scripting languages that can perform almost any kind of data transformation.
HTH,
isotope
Maybe you are looking for
-
IPod is seen by Windows but not iTunes
Ever since upgrading to iTunes V7.x (currently the latest version 7.3) my iPod does not show up in iTunes. I can access the iPod from Windows and open folders etc. My iPod is connected via Firewire and has worked fine in all versions of iTunes until
-
HP Officejet 6500 E709n Series on win 8.1 64 bit
I recently upgraded my computer to an asus desktop running win 8.1 64 bit. I cant get my officejet 6400n to install properly. I've tried uninstalling and reinstalling several times. It does recognize the printer and prints fine but the scanner doesn'
-
Flat file to idoc mapping issue
Hi Gurus, i had a flat file format in sender side as below: H_ID TYP_CODE line_elemet Quantity 5896 STANDARD 1.transmitter 1 5896 STANDARD 2.xxxxxxxxx 1 5896 STA
-
EPM add-in for Excel question : How to send data from local member?
Dear experts, for EPM add-in for excel, how do I send data from local member? best regards, Evans.
-
Hi all, The following is the simple bean I try to make import java.awt.*; import java.io.Serializable; public class SimpleBean extends Canvas implements Serializable { private Color color = Color.green; //getter method public Color getColor() {