Storing part of the file content into a variable.
All,
I have a log file containing lots of data now i want to extract all text between block below(only names) without the title/end pattern but only names,
++++START++++
SCOTT TIGER
HENRY PAUL
JARED TEXAS
BILL G. OWENS
++++END++++
the names i want to return and store in a variable in my korn-shell code.
Any help on this please?
regards,
Perhaps the following is not the most sophisticated solution, but probably easy to understand:
<pre>
$ var=$(sed -n '/++++START++++/,/++++END++++/p' your_logfile | head -n -1 | tail -n +2)
$ echo "$var"
SCOTT TIGER
HENRY PAUL
JARED TEXAS
BILL G. OWENS
</pre>
Note that you have to echo "$var" in double quotes in order for echo to print newlines.
Similar Messages
-
Get the file name into a Odi variable
Hi,
I need to get the file name into odi variable like ..A/ETC/file.txt
For eg.the filename file.txt should get store in a variable.
Then i want to compare the file name stored in the variable with some other value.
Please suggest.
Thanks.in package,
declare the variable, then evaluate it with another variable, generally using # syntax
if the variable is date type, suggest to use : syntax, because # will treat the variable value as text value
in loadplan
use case when syntax, -
What is the best way to merge a file content into log file
What is the best way to merge a file content into log file.
In worst case, I will read the file line by line as string, then use
logger.info(lineString)to output to log file.
However, is there better way to do this?
The eventual log file will be something like:
log message 1
log message 2
content from file line 1
content from file line 2
content from file line 3
log message 3
log message 4ThanksJohn618 wrote:
Thank you and let me explain:
1. What do you mean by better?
I would like to see better performance. read line by line and log each line as string can be slow. Did you measure this and determine that it is actually a problem for your application? Or are you guessing?
Regardless of what you do you are still going to need to read the file.
>
2.The only better way I can think of is not having to do it, but I assume you have a very good reason to want to do this.
Yes, I have to do it beacuse the requirement is to have that file content be part of logging.
Any idea?How is it supposed to be part of it? For example which of the following is better?
File AAA - contents
First Line
Second Line XXX
Log 1
2009-03-27 DEBUG: Random preceding line
2009-03-27 DEBUG: First Line
2009-03-27 DEBUG: Second Line XXX
2009-03-27 DEBUG: Random following line
Log 2
2009-03-27 DEBUG: Random preceding line
2009-03-27 DEBUG: ----- File: AAA -------------
First Line
Second Line XXX
2009-03-27 DEBUG: Random following lineBoth of the above have some advantages and disadvantages.
The first in a mult-threaded app can end up with intermittent log entries in between lines, so having log lines with thread ids becomes important.
The first can be created by reading one line at a time and posting one at a time.
The second can be created by reading the entire file as a single string and then posting using a single log statement. -
How to write the JTables Content into the CSV File.
Hi Friends
I managed to write the Database records into the CSV Files. Now i would like to add the JTables contend into the CSV Files.
I just add the Code which Used to write the Database records into the CSV Files.
void exportApi()throws Exception
try
PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
System.out.println("Connected");
stexport=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
rsexport=stexport.executeQuery("Select * from IssuedBook ");
ResultSetMetaData md = rsexport.getMetaData();
int columns = md.getColumnCount();
String fieldNames[]={"No","Name","Author","Date","Id","Issued","Return"};
//write fields names
String rec = "";
for (int i=0; i < fieldNames.length; i++)
rec +='\"'+fieldNames[i]+'\"';
rec+=",";
if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
writing.println(rec);
//write values from result set to file
rsexport.beforeFirst();
while(rsexport.next())
rec = "";
for (int i=1; i < (columns+1); i++)
try
rec +="\""+rsexport.getString(i)+"\",";
rec +="\""+rsexport.getInt(i)+"\",";
catch(SQLException sqle)
// I would add this System.out.println("Exception in retrieval in for loop:\n"+sqle);
if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
writing.println(rec);
writing.close();
}With this Same code how to Write the JTable content into the CSV Files.
Please tell me how to implement this.
Thank you for your Service
JofinHi Friends
I just modified my code and tried according to your suggestion. But here it does not print the records inside CSV File. But when i use ResultSet it prints the Records inside the CSV. Now i want to Display only the JTable content.
I am posting my code here. Please run this code and find the Report.csv file in your current Directory. and please help me to come out of this Problem.
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.table.*;
public class Exporting extends JDialog implements ActionListener
private JRadioButton rby,rbn,rbr,rbnore,rbnorest;
private ButtonGroup bg;
private JPanel exportpanel;
private JButton btnExpots;
FileReader reading=null;
FileWriter writing=null;
JTable table;
JScrollPane scroll;
public Exporting()throws Exception
setSize(550,450);
setTitle("Export Results");
this.setLocation(100,100);
String Heading[]={"BOOK ID","NAME","AUTHOR","PRICE"};
String records[][]={{"B0201","JAVA PROGRAMING","JAMES","1234.00"},
{"B0202","SERVLET PROGRAMING","GOSLIN","1425.00"},
{"B0203","PHP DEVELOPMENT","SUNITHA","123"},
{"B0204","PRIAM","SELVI","1354"},
{"B0205","JAVA PROGRAMING","JAMES","1234.00"},
{"B0206","SERVLET PROGRAMING","GOSLIN","1425.00"},
{"B0207","PHP DEVELOPMENT","SUNITHA","123"},
{"B0208","PRIAM","SELVI","1354"}};
btnExpots= new JButton("Export");
btnExpots.addActionListener(this);
btnExpots.setBounds(140,200,60,25);
table = new JTable();
scroll=new JScrollPane(table);
((DefaultTableModel)table.getModel()).setDataVector(records,Heading);
System.out.println(table.getModel());
exportpanel= new JPanel();
exportpanel.add(btnExpots,BorderLayout.SOUTH);
exportpanel.add(scroll);
getContentPane().add(exportpanel);
setVisible(true);
public void actionPerformed(ActionEvent ae)
Object obj=ae.getSource();
try {
PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
if(obj==btnExpots)
for(int row=0;row<table.getRowCount();++row)
for(int col=0;col<table.getColumnCount();++col)
Object ob=table.getValueAt(row,col);
//exportApi(ob);
System.out.println(ob);
System.out.println("Connected");
String fieldNames[]={"BOOK ID","NAME","AUTHOR","PRICE"};
String rec = "";
for (int i=0; i <fieldNames.length; i++)
rec +='\"'+fieldNames[i]+'\"';
rec+=",";
if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
writing.println(rec);
//write values from result set to file
rec +="\""+ob+"\",";
if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
writing.println(rec);
writing.close();
catch(Exception ex)
ex.printStackTrace();
public static void main(String arg[]) throws Exception
Exporting ex= new Exporting();
}Could anyone Please modify my code and help me out.
Thank you for your service
Cheers
Jofin -
How to view the file content from the directory? getting Error:ORA-21560
SQL> create directory READ_LOB_DIR as 'D:\Prj\Comm\Data';
CREATE OR REPLACE Procedure READ_FILE_LOB IS
-- Input Directory as specified in create directory
l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
-- Input File which is read word by word
l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
-- Separator Character between words is a BLANK (ascii = 32)
l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
-- Character at the end of the file is NEWLINE (ascii = 10)
l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
-- Pointer to the BFILE
l_loc BFILE;
-- Current position in the file (file begins at position 1)
l_pos NUMBER := 1;
-- Amount of characters have been read
l_sum BINARY_INTEGER := 0;
-- Read Buffer
l_buf VARCHAR2(500);
-- End of the current word which will be read
l_end NUMBER;
-- Return value
l_ret BOOLEAN := FALSE;
BEGIN
-- Mapping the physical file with the pointer to the BFILE
l_loc := BFILENAME(l_dir, l_fil);
-- Check if the file exists
l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
IF (l_ret) THEN
dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
' exists');
-- Open the file in READ_ONLY mode
DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
LOOP
-- Calculate the end of the current word
l_end := DBMS_LOB.INSTR(l_loc, l_seb, l_pos, 1);
-- Process end-of-file
IF (l_end = 0) THEN
l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
l_sum := l_end - l_pos - 1;
DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
EXIT;
END IF;
-- Read until end-of-file
l_sum := l_end - l_pos;
DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
l_pos := l_pos + l_sum + 1;
END LOOP;
DBMS_LOB.CLOSE(l_loc);
ELSE
dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
' does not exist');
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error:' || SQLERRM);
DBMS_LOB.CLOSE(l_loc);
END;
The Text file content is...
Copyright 1996,2001 Oracle Corporation. All Rights Reserved
This file contains installation instructions for installing the
Oracle8 ODBC Driver software.
It is divided into four parts:
o Part I: Summary of systems supported by Oracle8 ODBC client
software
Lists the platforms on which the Oracle8 ODBC Client software can
be installed.
o Part II: Oracle8 ODBC Driver software.
Describes the files, and installation prerequisites for the Oracle8
ODBC driver software.
o Part III: Exploding the kit onto your system
Describes how to explode the kit onto your system hard drive.
o Part IV: Installation Instructions
Describes how to install the Oracle8 ODBC driver.
Part I: Systems supported by the Oracle8 client software
You can install the ODBC client software on any of the following systems:
o Windows 2000
o Windows NT X86
o Windows 95
o Windows 98
The Oracle8 ODBC Driver provides support for ODBC connections
from Windows 2000, Windows NT, Windows 95, and Windows 98 systems
to Oracle databases.
o Part II: Oracle8 ODBC Driver software.
Refer to the following files for information about the Oracle8 ODBC Driver:
LICENSE.TXT - Oracle8 ODBC Driver License Agreement. Read carefully
before installing and/or using this product. Enclosed in
your software distribution kit.
SQORA.HLP - A Window's Help file which is the primary reference
manual for the Oracle8 ODBC Driver.
ODBCRelnotes.WRI - The release notes for the Oracle8 ODBC Driver
which contains information which may have not been
included in the Help file.
Installation Prerequisites
See the Oracle8 ODBC Driver release notes (ODBCRelnotes.WRI),
for a complete list of software products required and their versions.
Time Required
The installation of the Oracle8 ODBC Driver takes approximately 5
minutes. The actual time may be shorter or longer, depending upon
your hardware configuration.
Disk Space Required
The Oracle8 ODBC driver installation requires approximately 2
megabytes of available storage space. The space required depends upon
what files you already have installed. The installation procedure
checks to see if you have enough available disk space. If you do not,
the installation fails.
Part III: Exploding the Kit onto your system
Expand the self-extracting archive file onto your hard drive.
C:\> ORA8174.EXE
Part IV: Installation Instructions
Oracle8 ODBC Driver 8.1.7.4.0
This section assumes the following:
1. MS Windows 2000, Windows NT, Windows 95 or Windows 98 is running.
2. Oracle Universal Installer shipping with 8.1.7 has already been
installed on your system.
3. Part III has been completed.
Software fixes:
Refer to release notes (ODBCRelnotes.wri) for a complete list of
Software fixes.
Installation Instructions
Once the self-extracting archive file ORA8174.EXE has been
exploded it will create an installable directory structure
onto your hard drive. Run the Oracle Universal Installer from
your local drive.
1. On the screen "File Locations" use the "Browse" button of
the source path to choose the file 'products.jar' from the
folder that ORA8174.EXE was extracted to. Choose 'Next'.
2. You will receive a warning that some of the dependencies of
this product are not found in the staging area. This warning
is OK. The ODBC driver depends on the Net8 Client being already
installed on the system. Answer 'Yes' to continue.
Oracle is a registered trademark of Oracle Corporation.
Microsoft, MS are registered trademarks of Microsoft Corporation.
Microsoft Windows, Windows NT, Windows 95, Windows 98 and Open Database
Connectivity are trademarks of Microsoft Corporation.
All other trademarks and registered trademarks are the property
of their respective owners.
The output was...
File testfile.txt in Directory READ_LOB_DIR exists
Copyright
1996,2001
Oracle
Corporation.
All
Rights
Reserved
This
file
contains
installation
instructions
for
installing
the
Oracle8
ODBC
Driver
software.
It
is
divided
into
four
parts:
o
Part
I:
Summary
of
systems
supported
by
Oracle8
ODBC
client
Error:ORA-21560: argument 2 is null, invalid, or out of range
I want to diplay/view as per file content format from the file under that specified directory.
Have any other method / any help or suggestions would be really appreciated.I changed the code like...
CREATE OR REPLACE Procedure READ_FILE_LOB_tmp IS
-- Input Directory as specified in create directory
l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
-- Input File which is read word by word
l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
-- Separator Character between words is a BLANK (ascii = 32)
l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
-- Character at the end of the file is NEWLINE (ascii = 10)
l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
-- Pointer to the BFILE
l_loc BFILE;
-- Current position in the file (file begins at position 1)
l_pos NUMBER := 1;
-- Amount of characters have been read
l_sum BINARY_INTEGER := 0;
-- Read Buffer
l_buf VARCHAR2(4000);
-- End of the current word which will be read
l_end NUMBER;
-- Return value
l_ret BOOLEAN := FALSE;
BEGIN
-- Mapping the physical file with the pointer to the BFILE
l_loc := BFILENAME(l_dir, l_fil);
-- Check if the file exists
l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
IF (l_ret) THEN
dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
' exists');
-- Open the file in READ_ONLY mode
DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
LOOP
-- Calculate the end of the current word
l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
-- Process end-of-file
IF (l_end = 0) THEN
EXIT;
END IF;
-- Read until end-of-file
l_sum := l_end - l_pos;
DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
l_pos := l_pos + l_sum + 1;
END LOOP;
DBMS_LOB.CLOSE(l_loc);
ELSE
dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
' does not exist');
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error:' || SQLERRM);
DBMS_LOB.CLOSE(l_loc);
END;
Now its working fine with one addtional line...
The file content is...
This is My Content
This is My Content
This is My Content
This is My Content
This is My Content
But The output was...
File testfile.txt in Directory READ_LOB_DIR exists
This is My Content
This is My Content
This is My Content
This is My Content
This is My Content
here, i want to delete that additonal line...? -
Loading File name and file contents into two separate tables using Sqlloadr
Hi All,
I have situtation like to load File contents into One table and File name into one table . File comes with .txt extension
Example :
File name : product_09_abc.txt
File contents :
Productcode
ABC
CDE
EFT
Can you please help me out this how can we acheive this using SQLLOADER.SQL*Loader will not pass through the filename for you to be able to insert into a table.
You will need to have a controlling o/s script that picks up the file name, calls sql*loader and then also call's an SQL script (using sql*plus?) to insert the filename into a.n.other table. -
Function module for transfering a file contents into another?
Hi all,
Is there a Function module for transfering a file contents into another?That is the whole content from a file to other??
Regards,
Shashank.Hi,
I think there is no such FM. You need to read the data in internal table and then write it in another file.
Regards,
Atish -
Turn a text file content into a dropdown box
Hi Folks,
I have a text file filled with commands. and i would like to turn this text file into a dropdown ring box, how do i do that??
textfile attached.
Lee
Solved!
Go to Solution.
Attachments:
commands.txt 2 KBThat's not extracting anything from the lines. That's just dumping the contents of the file directly into the ring. That can be accomplished by simply doing this:
Message Edited by smercurio_fc on 06-03-2010 05:03 PM
Attachments:
fp.png 38 KB
dump into ring.vi 9 KB -
I'v downloaded a tv series,paid for it, its in my itunes but with exclamation marks next to it, every time it tries to download the series it says "part of the file seems to be corrupted" and tells me to redownload it.Tried that 8 times and it comes up the same. What do I do?
Clear the contents of ...iTunes\iTunes Media\Download and try one more time.
If the problem recurs use the "report a problem" links in your account history and explain what has happened so far. There may be a problem with the source rather than your download of it.
tt2 -
How to insert External XML file content into XMLTYPE through Pro*c
Could any one sugest me how to insert a external XML file content into Db
into XMLTYPE datatype through Pro*c program.
Thanks for any help...... who has done this
Ghanta TagoreHi
After some good fight of 3 days, I have done it through Pro*c
This is the way to handle this
Buffer-->Temporary Clob-->XMLTYPE(using CreateXml)
Pasting my piece o code to do this
===============
OCIClobLocator *license_txt;
varchar h_ttt[1024] = {'\0'};
ub4 amt;
int i;
EXEC SQL ALLOCATE :license_txt;
EXEC SQL LOB CREATE TEMPORARY :license_txt ;
GetName(name); /*Gets Name to insert into name column in License Table*/
for(i=0; i<4;i++)
GetXMLL((char *)h_ttt.arr); /*Gets a string value of XML into this example*/
/*<Tagore>Is From TCS Delhi</Tagore>*/
/*This can be changed to get buffer from FILE */
h_ttt.len = strlen((char *)h_ttt.arr);
amt = sizeof(char) * h_ttt.len ;
EXEC SQL LOB WRITE APPEND :amt FROM :h_ttt INTO :license_txt;
EXEC SQL
INSERT INTO license_table VALUES (:sss, :name, sys.xmltype.createXML(:license_txt))
================
Thanks For ur Help
Tagore Ghanta -
Edit copy in a CS6 file, but lock formatting of parts of the file
I have a client that needs to be able to edit some copy in a file that I've created in adobe Illustrator CS6, but I want to be able to lock the formatting of parts of the file. I don't want them to use CS6.Suggestions?
Can't do. At best you could offer them a hacky solution liek creating a PDF form with an editable text field, but it may end up looking awful.
Mylenium -
How to create, place, format and paste the clipboard contents into a text frame
I am new to scripting and need help. I have an existing Indesign document. I need to be able to create a text frame on my current page, the width of my margins with the top of the text frame at the top margin and 1" in height, then format it to be 1-column, and then paste the clipboard contents into it and tag the text with a particular paragraph style. I am using Indesign CS4 on a mac, if that makes any difference. Thanks for any help.
May this will help you. It will create an anchored object with a text what you desired, with object style. You should create an object style before with the x and y co ordinates. You can choose either para style or character style.
var the_document = app.documents.item(0);
// Create a list of paragraph styles
var list_of_paragraph_styles = the_document.paragraphStyles.everyItem().name;
// Create a list of character styles
var list_of_character_styles = the_document.characterStyles.everyItem().name;
// Create a list of object styles
var list_of_object_styles = the_document.objectStyles.everyItem().name;
// Make dialog box for selecting the styles
var the_dialog = app.dialogs.add({name:"Create anchored text frames"});
with(the_dialog.dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:"Make the anchored frames from ..."});
with(dialogRows.add()){
staticTexts.add({staticLabel:"This character style:"});
var find_cstyle = dropdowns.add({stringList:list_of_character_styles, selectedIndex:0});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Or this paragraph style:"});
var find_pstyle = dropdowns.add({stringList:list_of_paragraph_styles, selectedIndex:0});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Leave one dropdown unchanged!"});
dialogRows.add();
with(dialogRows.add()){
staticTexts.add({staticLabel:"Delete matches?"});
var delete_refs = dropdowns.add({stringList:["Yes","No"], selectedIndex:0});
dialogRows.add();
with(dialogRows.add()){
staticTexts.add({staticLabel:"Anchored text frame settings:"});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Object style:"});
var anchor_style = dropdowns.add({stringList:list_of_object_styles, selectedIndex:0});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Frame width:"});
var anchor_width = measurementEditboxes.add({editUnits:MeasurementUnits.MILLIMETERS, editValue:72});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Frame height:"});
var anchor_height = measurementEditboxes.add({editUnits:MeasurementUnits.MILLIMETERS, editValue:72});
the_dialog.show();
// Define the selected styles
var real_find_cstyle = the_document.characterStyles.item(find_cstyle.selectedIndex);
var real_find_pstyle = the_document.paragraphStyles.item(find_pstyle.selectedIndex);
var real_anchor_style = the_document.objectStyles.item(anchor_style.selectedIndex);
// Check if a style is selected
if(find_cstyle.selectedIndex != 0 || find_pstyle.selectedIndex != 0) {
// Define whether to search for character styles or paragraph styles
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
if(find_cstyle.selectedIndex != 0) {
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedCharacterStyle = real_find_cstyle;
} else {
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedParagraphStyle = real_find_pstyle;
app.findGrepPreferences.findWhat = "^";
// Search the document
var found_items = the_document.findGrep();
myCounter = found_items.length-1;
do {
// Select and copy the found text
var current_item = found_items[myCounter];
if(find_pstyle.selectedIndex != 0) {
var found_text = current_item.paragraphs.firstItem();
var insertion_character = (found_text.characters.lastItem().index) + 1;
var check_insertion_character = insertion_character + 1;
var alt_insertion_character = (found_text.characters.firstItem().index) - 1;
var the_story = found_text.parentStory;
app.selection = found_text;
if(delete_refs.selectedIndex == 0) {
app.cut();
} else {
app.copy();
} else {
var found_text = current_item;
var insertion_character = (found_text.characters.lastItem().index) + 2;
var check_insertion_character = insertion_character;
var alt_insertion_character = (found_text.characters.firstItem().index) - 1;
var the_story = found_text.parentStory;
app.selection = found_text;
if(delete_refs.selectedIndex == 0) {
app.cut();
} else {
app.copy();
// Make text frame from selection
try {
app.selection = the_story.insertionPoints[check_insertion_character];
app.selection = the_story.insertionPoints[insertion_character];
} catch(err) {
app.selection = the_story.insertionPoints[alt_insertion_character];
var the_anchored_frame = app.selection[0].textFrames.add({geometricBounds:["0","0",anchor_height.editContents,anch or_width.editContents],anchoredObjectSettings:{anchoredPosition: AnchorPosition.ANCHORED}});
app.selection = the_anchored_frame.insertionPoints[0];
app.paste();
// Apply the object style now to "force apply" paragraph style set in the object style
if(anchor_style.selectedIndex != 0) {
the_anchored_frame.appliedObjectStyle = real_anchor_style;
myCounter--;
} while (myCounter >= 0);
} else {
alert("No styles selected!"); -
Could not parse the file contents as a data set. There were too many variable names in the first line of the text file.
What are the Variables settings, what is the text file’s content, …?
-
Reading a File by Knowing a part of the file name
Hi Java Gurus,
Can I copy a file to another location by knowing a part of the file name.I know the extension of the file and part of the file name.Can I copy such a file to another directory?
Eg :
0099999999_JAPPLIC_20090320.pdf is the file name.
I know the file name contains 'JAPPLIC' .Can I use this clue and the extension of the file to copy the file to another directory.
Please let me know whether it is possible or not.
Regards,
Rakesh.Hi ,
I used the below code and I was able to solve the problem.I was able to select the files of the required extension and serach for the file names containing the text I know and use such files and move to another directory.It may be helpfulk to you people
public class FileDeletion {
public static void main (String args[]) {
String e = "";
String d = "C:\\TCCTouchpoints\\Attachments_Export\\outbound";
String newFileLoc = "C:\\TCCTouchpoints\\Attachments_Export\\move";
ExtensionFilter filter = new ExtensionFilter(e);
File dir = new File(d);
File newLoc = null;
String[] list = dir.list(filter);
if (list.length == 0) return;
System.out.println("File Length "+list.length);
ArrayList fileNames = new ArrayList();
for (int i = 0; i < list.length; i++) {
/*file = new File(d + list);
boolean isdeleted = file.delete();
System.out.print(file);
System.out.println( " deleted " + isdeleted);*/
System.out.println(list[i]);
if(list[i].contains("_F5029.03_")){
fileNames.add(list[i]);
//System.out.println(list[i]);
dir = null;
for(int i=0;i<fileNames.size();i++){
dir = new File(d+"\\"+fileNames.get(i));
newLoc = new File(newFileLoc+"\\"+fileNames.get(i));
if(dir.renameTo(newLoc)){
System.out.println(dir + " is moved to "+ newLoc);
}else {
System.out.println("***** " dir " is not moved to "+ newLoc);
dir = null; newLoc = null;
for(int i=0;i<list.length;i++){
dir = new File(d+"\\"+list[i]);
dir.delete();
class ExtensionFilter implements FilenameFilter {
private String extension;
public ExtensionFilter( String extension ) {
this.extension = extension;
public boolean accept(File dir, String name) {
return (name.endsWith(extension));
Thanks for replying ....... -
In Windows, when Firefox (I'm currently using 7.0) downloads a file, it appends ''.PART'' to the file name of the currently downloading file and just renames it to its original file name after it finishes downloading.
I sometimes like to watch a currently downloading video file, so it will be better if Firefox just downloads the file to its actual filename (like what Opera does), so I can easily double click the incompletely downloaded file and watch it with the video player assigned to that file extension, rather than the awkward ''Right click -> Open With -> Choose Default Program'' route with .part files.
Does anyone know how to set Firefox to do this?It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files by Firefox and prevents Firefox from renaming the .part file.
Try to disable the real-time (live) scanning of files in your anti-virus software temporarily to see if that makes downloading work.
See "Disable virus scanning in Firefox preferences - Windows"
* http://kb.mozillazine.org/Unable_to_save_or_download_files
Maybe you are looking for
-
Please help me. I want to sync all of my data on my iPad 3, my Macbook Pro and my Mac Desktop. I have created an iCloud account and what I see on my Macbook Pro is also on my iPad. How do I now download the data which I think is on my iCloud accoun
-
How do I create a whole new iTunes on my iMac?
I have an external hard drive with my whole catalog of music that will be my iTunes library. Wanting to start fresh I removed all the the iTunes media off my iMac, moved my iTunes to the trash and then went to the Apple website and downloaded and t
-
Inconsistent results sql versus plsql
I'm using Oracle SQL Developer v1.1.2.25 in an Oracle 10g environment and obtain a different results set depending on whether I use SQL or PLSQL to retrieve the data. The select statement is a relatively simple one ( a distinct (desired_column) selec
-
I am very disturbed to find that the latest version of Keynote (6.1) cannot open older (pre-Keynote 09) files. I tried to install Keynote 9 on my MacBook Air running Mac OS X 10.9.2, but it doesn't launch. I can't be the only person with this problem
-
Error code -36 trying to copy from iPhoto library
Hi all, A friend has just brought me his 17" Mac Book Pro which refuses to boot. I started in target mode connected to a Mac Pro to see if I could rescue his data, (no backup as usual). The first thing that I see is that he has 2.3Gb of space left wh