Replacing text in Text File in a perticuler line number
Hi,
I have a text file where values will be stored like
user=alex;checkout=no;checkin=yes;
user=rexy;checkout=yes;checkin=yes;
user=nik;checkout=no;checkin=no;
user=philip;checkout=yes;checkin=no;
user=nex;checkout=yes;checkin=no;
I know the line number of user nik(no=3) how can i replace that full line only with new values
or a particular part (checkout=yes).According to each event i have to change a specific part in text file for that user .
Thanks
[email protected]
Read the first two lines and write them to a new file. Write the new values for line 3 to that new file. Read the rest of the lines and write them to that new file. Close all the files, delete the old file, rename the new file.
Similar Messages
-
How to read a file starting from certain line number
Hi there
I need to read a large text file line by line. The user will have the ability to stop at any time and run the application to resume reading and processing. For example, if the user stops at line 350, next time when the user run the application, I want him to be able to start with line 351. I am using BufferedReader to read the file. What should I do enable to read the file starting certain line number? Each line in the text file is not equal in length, so I can not control by bytes ...
Thanks!Since you can't count bytes, there's no way of knowing where to jump except actually reading trough all those preceding lines. (You don't have to store them, though.)
for(int linenum=0, linenum<jumpTo; ++linenum) {
reader.readLine();
} -
How to read a file and save the line number of the last line read?
Hi,
I am using RandomAccessFile and file as my class. I am trying to read a log file as it gets updated and print it out to a java window. i so far have the framework setup but dont know how to save the last line number so.
i need this variable so i dont reprint out the same line numbers to the java window. please advise.
thanks!hi,
i now have the line number of the last line read, but now when i reopen the file, how can i skip that number of lines?
thanks, -
Please hep to generate same line number to print in file
Hi
I am generating file by taking data from few tables. I need to generate file data from below structure data :
i.e In table A for order O having product p1,p2,p3,p4, lines will be wrriten to file in following manner
Line Number
O -p1 - 1
O -p2 - 2
O -p3 - 3
O -p4 - 4
Now another line is from table which will have only two product entries for the order O in below manner
i.e In table B for order O having product p2,p4. so for this lines should be match with above line number of order like this :
Line Number
O - p2 -2
O - p4 -4
First all data from table A will be writeen. Then only from TABLE B data should be wrriten to file.
Can anybody please help how to match line number for both the tables?
Thanks in advancePerhaps a clearer output would be if we had different descriptions on each of the tables A an B to output with each of the rows..
SQL> ed
Wrote file afiedt.buf
1 with A as (select 1 as order_id, 'p1' as product_id, 'A - order 1 product 1' as descr from dual union all
2 select 1, 'p2', 'A - order 1 product 2' from dual union all
3 select 1, 'p3', 'A - order 1 product 3' from dual union all
4 select 1, 'p4', 'A - order 1 product 4' from dual union all
5 select 2, 'p1', 'A - order 2 product 1' from dual union all
6 select 2, 'p2', 'A - order 2 product 2' from dual union all
7 select 2, 'p3', 'A - order 2 product 3' from dual)
8 ,B as (select 1 as order_id, 'p2' as product_id, 'B - order 1 product 2' as descr from dual union all
9 select 1, 'p4', 'B - order 1 product 4' from dual union all
10 select 2, 'p3', 'B - order 2 product 3' from dual)
11 -- end of test data
12 select order_id
13 ,product_id
14 ,row_number() over (partition by order_id order by product_id) as line_number
15 ,descr
16 from A
17 union all
18 select order_id, product_id, line_number, descr
19 from (
20 select b.order_id
21 ,b.product_id
22 ,row_number() over (partition by a.order_id order by a.product_id) as line_number
23 ,b.descr
24 from A left outer join B on (a.order_id = b.order_id and a.product_id = b.product_id)
25 )
26* where order_id is not null
SQL> /
ORDER_ID PR LINE_NUMBER DESCR
1 p1 1 A - order 1 product 1
1 p2 2 A - order 1 product 2
1 p3 3 A - order 1 product 3
1 p4 4 A - order 1 product 4
2 p1 1 A - order 2 product 1
2 p2 2 A - order 2 product 2
2 p3 3 A - order 2 product 3
1 p2 2 B - order 1 product 2
1 p4 4 B - order 1 product 4
2 p3 3 B - order 2 product 3
10 rows selected.
SQL> -
Find & Replace text in html files
This is my first real attempt at using Automator, and it has become increasingly frustrating for me. I love the idea of Automator, nice interface, and it appears to be so easy to use. But, I can't get it to actually DO anything and I don't understand why.
Here is my goal:
to batch process multiple html files to remove certain characters and words (or replace them with empty space).
I currently open these files in Pages and do 6 separate Find & Replace commands for each file before I continue with my other processing tasks. This is very tedious and I believe the computer should be able to find & replace multiple items at one time. (I have used other utilities to do batch renaming and trimming file names before.)
All I want to do is select a group of files (usually 25 at a time) and have Automator get rid of all the unwanted words and characters before I open each file for final processing in Pages. I found a set of Automator actions for TextEdit which includes a Find & Replace action, but I've wasted over an hour so far trying to get it to work.
When I run the workflow, it acts like it's doing something, but the files remain unchanged. I have tried using actions such as Read Text File, Get Contents of TextEdit Document, Set Contents of TextEdit Document, along with 6 instances of Find & Replace, but I cannot get it to work.
I'm at a point today where I cannot afford to mess around with this anymore. I have to do it the long way in Pages or else I'll never get it done, but I want to get these Automator workflows to work before I have to repeat this task. (I do this at least once a week right now.)
Any ideas or suggestions? I've tried reading in the help menus and support pages, but perhaps I'm just not understanding something here.Any ideas or suggestions?
You might be interested in using TextWrangler. It can perform batch find-and-replace changes across multiple selected files.
Good luck!
Andrew99 -
Help with Replacing text in a file using a vbscript
I have the following script which I am wanting to
1. Take the prf file and read it
2. Edit a line in the outlook .prf file replacing it with the text I have asked it to replace which is the full name of the user pulled from the currently logged on user
The problem I am seeing is that when the temp file is being generated it is throwing off the formatting of the file hence the script doesn't work. Can anyone help me please.
set objSysInfo = CreateObject("ADSystemInfo")
struser = objSysInfo.Username
set objUser = GetObject("LDAP://" & strUser)
strFullName = objUser.Get("displayName")
Const ForReading=1
Const ForWriting=2
Set objFSO = CreateObject("Scripting.FileSystemObject")
folder = "C:\test"
'filePath = folder & "file.txt"
filePath = "c:\test\test2007_3.prf"
Set myFile = objFSO.OpenTextFile(filePath, ForReading)
Set myTemp= objFSO.OpenTextFile(filePath & ".tmp", ForWriting, True)
Do While Not myFile.AtEndofStream
myLine = myFile.ReadLine
If InStr(myLine, "MailboxName=%UserName%") Then
myLine = "&strFullName"
End If
myTemp.WriteLine myLine
Loop
myFile.Close
myTemp.Close
objFSO.DeleteFile(filePath)
objFSO.MoveFile filePath& ".tmp", filePath
ChristopherSorry Irv,
Here is the code I have and then after that is the prf file. I think there is an issue with the file structure because if I take a regular text file and add the lines in there myself it replaces the lines, but with the prf file or even the prf file as a
text file it gives me the invalid argument message
Const filePath = "c:\test\test2007_3.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set myFile = objFSO.OpenTextFile(filePath)
fileText = myFile.ReadAll()
myFile.Close
fileText=Replace(fileText,"%UserName%","THIS_IS_THS_REPLACEMENT_TEXT")
Set myTemp= objFSO.OpenTextFile(filePath, 2, True)
myTemp.Write fileText
myTemp.Close
;Automatically generated PRF file from the Microsoft Office Customization and Installation Wizard
; Section 1 - Profile Defaults
[General]
Custom=1
ProfileName=Somthing
DefaultProfile=Yes
OverwriteProfile=Yes
ModifyDefaultProfileIfPresent=false
DefaultStore=Service1
; Section 2 - Services in Profile
[Service List]
ServiceX=Microsoft Outlook Client
ServiceEGS=Exchange Global Section
Service1=Microsoft Exchange Server
ServiceEGS=Exchange Global Section
; Section 3 - List of internet accounts
[Internet Account List]
; Section 4 - Default values for each service.
[ServiceX]
CachedExchangeMode=0x00000002
CachedExchangeSlowDetect=true
[ServiceEGS]
CachedExchangeConfigFlags=0x00000900
MailboxName=%UserName%
HomeServer=
RPCoverHTTPflags=0x0027
RPCProxyServer=
RPCProxyPrincipalName=
RPCProxyAuthScheme=0x0001
[Service1]
OverwriteExistingService=No
UniqueService=Yes
MailboxName=%UserName%
HomeServer=
OfflineAddressBookPath=%USERPROFILE%\local settings\application data\microsoft\outlook\
OfflineFolderPathAndFilename=%USERPROFILE%\local settings\application data\microsoft\outlook\outlook.ost
AccountName=Microsoft Exchange Server
DefaultAccount=TRUE
;[ServiceX]
;FormDirectoryPage=
;-- The URL of Exchange Web Services Form Directory page used to create Web forms.
;WebServicesLocation=
;-- The URL of Exchange Web Services page used to display unknown forms.
;ComposeWithWebServices=
;-- Set to true to use Exchange Web Services to compose forms.
;PromptWhenUsingWebServices=
;-- Set to true to use Exchange Web Services to display unknown forms.
;OpenWithWebServices=
;-- Set to true to prompt user before opening unknown forms when using Exchange Web Services.
; Section 5 - Values for each internet account.
; Section 6 - Mapping for profile properties
[Microsoft Exchange Server]
ServiceName=MSEMS
MDBGUID=5494A1C0297F101BA58708002B2A2517
MailboxName=PT_STRING8,0x6607
HomeServer=PT_STRING8,0x6608
OfflineAddressBookPath=PT_STRING8,0x660E
OfflineFolderPathAndFilename=PT_STRING8,0x6610
[Exchange Global Section]
SectionGUID=13dbb0c8aa05101a9bb000aa002fc45a
MailboxName=PT_STRING8,0x6607
HomeServer=PT_STRING8,0x6608
RPCoverHTTPflags=PT_LONG,0x6623
RPCProxyServer=PT_UNICODE,0x6622
RPCProxyPrincipalName=PT_UNICODE,0x6625
RPCProxyAuthScheme=PT_LONG,0x6627
CachedExchangeConfigFlags=PT_LONG,0x6629
[Microsoft Mail]
ServiceName=MSFS
ServerPath=PT_STRING8,0x6600
Mailbox=PT_STRING8,0x6601
Password=PT_STRING8,0x67f0
RememberPassword=PT_BOOLEAN,0x6606
ConnectionType=PT_LONG,0x6603
UseSessionLog=PT_BOOLEAN,0x6604
SessionLogPath=PT_STRING8,0x6605
EnableUpload=PT_BOOLEAN,0x6620
EnableDownload=PT_BOOLEAN,0x6621
UploadMask=PT_LONG,0x6622
NetBiosNotification=PT_BOOLEAN,0x6623
NewMailPollInterval=PT_STRING8,0x6624
DisplayGalOnly=PT_BOOLEAN,0x6625
UseHeadersOnLAN=PT_BOOLEAN,0x6630
UseLocalAdressBookOnLAN=PT_BOOLEAN,0x6631
UseExternalToHelpDeliverOnLAN=PT_BOOLEAN,0x6632
UseHeadersOnRAS=PT_BOOLEAN,0x6640
UseLocalAdressBookOnRAS=PT_BOOLEAN,0x6641
UseExternalToHelpDeliverOnRAS=PT_BOOLEAN,0x6639
ConnectOnStartup=PT_BOOLEAN,0x6642
DisconnectAfterRetrieveHeaders=PT_BOOLEAN,0x6643
DisconnectAfterRetrieveMail=PT_BOOLEAN,0x6644
DisconnectOnExit=PT_BOOLEAN,0x6645
DefaultDialupConnectionName=PT_STRING8,0x6646
DialupRetryCount=PT_STRING8,0x6648
DialupRetryDelay=PT_STRING8,0x6649
[Personal Folders]
ServiceName=MSPST MS
Name=PT_STRING8,0x3001
PathAndFilenameToPersonalFolders=PT_STRING8,0x6700
RememberPassword=PT_BOOLEAN,0x6701
EncryptionType=PT_LONG,0x6702
Password=PT_STRING8,0x6703
[Unicode Personal Folders]
ServiceName=MSUPST MS
Name=PT_UNICODE,0x3001
PathAndFilenameToPersonalFolders=PT_STRING8,0x6700
RememberPassword=PT_BOOLEAN,0x6701
EncryptionType=PT_LONG,0x6702
Password=PT_STRING8,0x6703
[Outlook Address Book]
ServiceName=CONTAB
[LDAP Directory]
ServiceName=EMABLT
ServerName=PT_STRING8,0x6600
UserName=PT_STRING8,0x6602
UseSSL=PT_BOOLEAN,0x6613
UseSPA=PT_BOOLEAN,0x6615
EnableBrowsing=PT_BOOLEAN,0x6622
DisplayName=PT_STRING8,0x3001
ConnectionPort=PT_STRING8,0x6601
SearchTimeout=PT_STRING8,0x6607
MaxEntriesReturned=PT_STRING8,0x6608
SearchBase=PT_STRING8,0x6603
CheckNames=PT_STRING8,0x6624
DefaultSearch=PT_LONG,0x6623
[Microsoft Outlook Client]
SectionGUID=0a0d020000000000c000000000000046
FormDirectoryPage=PT_STRING8,0x0270
WebServicesLocation=PT_STRING8,0x0271
ComposeWithWebServices=PT_BOOLEAN,0x0272
PromptWhenUsingWebServices=PT_BOOLEAN,0x0273
OpenWithWebServices=PT_BOOLEAN,0x0274
CachedExchangeMode=PT_LONG,0x041f
CachedExchangeSlowDetect=PT_BOOLEAN,0x0420
[Personal Address Book]
ServiceName=MSPST AB
NameOfPAB=PT_STRING8,0x001e3001
PathAndFilename=PT_STRING8,0x001e6600
ShowNamesBy=PT_LONG,0x00036601
; Section 7 - Mapping for internet account properties. DO NOT MODIFY.
[I_Mail]
AccountType=POP3
;--- POP3 Account Settings ---
AccountName=PT_UNICODE,0x0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;--- POP3 Account Settings ---
POP3Server=PT_UNICODE,0x0100
POP3UserName=PT_UNICODE,0x0101
POP3UseSPA=PT_LONG,0x0108
Organization=PT_UNICODE,0x0107
ReplyEmailAddress=PT_UNICODE,0x0103
POP3Port=PT_LONG,0x0104
POP3UseSSL=PT_LONG,0x0105
; --- SMTP Account Settings ---
SMTPServer=PT_UNICODE,0x0200
SMTPUseAuth=PT_LONG,0x0203
SMTPAuthMethod=PT_LONG,0x0208
SMTPUserName=PT_UNICODE,0x0204
SMTPUseSPA=PT_LONG,0x0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0x0010
SMTPPort=PT_LONG,0x0201
SMTPSecureConnection=PT_LONG,0x020A
ServerTimeOut=PT_LONG,0x0209
LeaveOnServer=PT_LONG,0x1000
[IMAP_I_Mail]
AccountType=IMAP
;--- IMAP Account Settings ---
AccountName=PT_UNICODE,0x0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;--- IMAP Account Settings ---
IMAPServer=PT_UNICODE,0x0100
IMAPUserName=PT_UNICODE,0x0101
IMAPUseSPA=PT_LONG,0x0108
Organization=PT_UNICODE,0x0107
ReplyEmailAddress=PT_UNICODE,0x0103
IMAPPort=PT_LONG,0x0104
IMAPUseSSL=PT_LONG,0x0105
; --- SMTP Account Settings ---
SMTPServer=PT_UNICODE,0x0200
SMTPUseAuth=PT_LONG,0x0203
SMTPAuthMethod=PT_LONG,0x0208
SMTPUserName=PT_UNICODE,0x0204
SMTPUseSPA=PT_LONG,0x0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0x0010
SMTPPort=PT_LONG,0x0201
SMTPSecureConnection=PT_LONG,0x020A
ServerTimeOut=PT_LONG,0x0209
CheckNewImap=PT_LONG,0x1100
RootFolder=PT_UNICODE,0x1101
[INET_HTTP]
AccountType=HOTMAIL
Account=PT_UNICODE,0x0002
HttpServer=PT_UNICODE,0x0100
UserName=PT_UNICODE,0x0101
Organization=PT_UNICODE,0x0107
UseSPA=PT_LONG,0x0108
TimeOut=PT_LONG,0x0209
Reply=PT_UNICODE,0x0103
EmailAddress=PT_UNICODE,0x000C
FullName=PT_UNICODE,0x000B
Connection Type=PT_LONG,0x000F
ConnectOID=PT_UNICODE,0x0010
Christopher -
Hi everyone,
Is it possible first to scan a paper document into Acrobat X Pro, and then to replace a "pane" or box within that PDF with a text or image file?
Would it require SDK and Javascript?
Thanks,
Rick WeinhausCtDave and others:
Here's the problem in more detail.
I am a physician and I already have the ability to incorporate paper-based
documents into an electronic health record (EHR) by scanning them and
saving them as PDFs. The documents are paper patient encounter forms with
a different box or 'pane' for each category of data. Each box has a fixed
location on the paper form.
There are three situations, however, where I want to have the option to
overwrite certain boxes of the PDF with data generated by methods other
than scanning.
1) Insert text macros with variable fields using the electronic health
record's software.
2) Insert a drawing available as a pre-existing JPG or generated by using a
tablet.
3) Insert text generated using Dragon Naturally Speaking.
For efficient office workflow, in all three cases the text or image to be
inserted into the box or 'pane' in the PDF needs to be generated while I am
still seeing the patient -- that is -- before the paper form has been
scanned and converted to a PDF.
The sticky note tool is one option, but I would want to be able to modify
the default size of the sticky note so that it corresponded exactly to the
size of the box it was 'overwriting.' I can't figure out how to do this?
Could it be done using scripting?
Furthermore, I would want the sticky notes to automatically display when
the PDF was opened, so that a hover would close rather than open them. This
sticky note method would have the advantage of allowing the user to toggle
back and forth between inserted data and any original handwritten text.
Any thoughts?
Rick -
Newbie question: how to replace a bunch of text in a file?
Good afternoon,
I have a very stupid problem here: I want to replace text in a file.
At first glance, this is very simple: just do:
sed -e 's/letter_a/alpha/g' test.txt > test2.txt
and the word "letter_a" will be replaced by the word "alpha" everywhere in the file "test.txt" and the results will be placed in file "test2.txt".
However my problem is a bit more complex:
I want to do different replacements in one file.
If I do:
sed -e 's/letter_a/alpha/g' test.txt
then the result will be shown on my screen, but I want the results to be stored in my file "test.txt".
I have already tried to do:
sed -e 's/letter_a/alpha/g' test.txt > test.txt
but this simply empties the file "test.txt".
As I have more than 50 replacements to do, I cannot do something like:
sed -e 's/letter_a/alpha/g' test.txt > test1.txt
sed -e 's/letter_b/beta/g' test1.txt > test2.txt
sed -e 's/letter_c/gamma/g' test2.txt > test3.txt
+...+
mv test50.txt test.txt
rm test1.txt
+...+
rm test50.txt
(It's possible in theory, but it's really too much work)
Do you know an easy command that does the following:
Replace "letter_a" by "alpha" in <filename> (without needing to specify another file where the output will be written)?
Thanks
Dominique
Edited by: scampsd on Oct 5, 2011 5:17 PMWhy don't you write a wrapper script that renames the input file to a temp file and run the sed to the original name. Something like:
<pre>
#!/bin/sh
# $1 = old string
# $2 = new string
# $3 = input/output file
cp -p $3 $3.zz$$ # preserves i-node of file
sed -e s/"$1"/"$2"/g < $3.zz$$ > $3
rm $3.zz$$
</pre> -
Powershell replace text in multiple files lookup CSV
Hiya guys
After some guidance please.
I have a CSV with following details
MailboxName, PRFNAME,TempConstant
usera, a, usera.prf,TEMPLATEPRFUSER
userb, b, userb.prf,TEMPLATEPRFUSER
userc, c, userc.prf,TEMPLATEPRFUSER
Im after creating multiple copies of a prf file with the PRFNAME
Import-Csv $UsernamesCSV | % { Copy-Item "C:\TemplatePRF\Template.prf" "C:\TEST\$($_.NewPRFName)"}
This creates multiple prfs named correctly based on the prfnames provided in the CSV
Now I want to search for mailboxname=TEMPLATEPRFUSER and replace to "MailboxName" from my csv.
so it will be
usera.PRF
ContentsMailboxname=user, a
userb.prf
contents
mailboxname=user, b
So the common field to replace will be TEMPALTEPRF but replace with the relevatnt mailboxname depending on prf name.
After looking around I found the following
Param (
#$List = "C:\TemplatePRF\mailbox.csv",
$Files = "c:\Test\*.prf"
$ReplacementList = Import-Csv $UsernamesCSV;
Get-ChildItem $Files |
ForEach-Object {
$Content = Get-Content -Path $_.FullName;
foreach ($ReplacementItem in $ReplacementList)
$Content = $Content.Replace($ReplacementItem.TEMPConstant, $ReplacementItem.mailboxn)
Set-Content -Path $_.FullName -Value $Content
At the moment all the files will then have the content "mailboxname=" set as user,a and it does not seem to loop through the remaining and replace correctly.It looks like something along these lines should work, though the CSV data you posted is currently invalid. If you want to have a comma in a field (such as user, a), it needs to be quoted. Otherwise the comma is treated as a delimiter in the CSV. Generally,
I would recommend just quoting everything, to avoid problems. That's what PowerShell does when you use Export-Csv. Here's the test file I used:
"MailboxName","PRFNAME"
"usera, a","usera.prf"
"userb, b","userb.prf"
"userc, c","userc.prf"
I got rid of the TempConstant field; there's no reason to repeat that data on every line of the CSV file. It's just hard-coded in the script right now. Here's the code:
$templateFile = 'C:\TemplatePRF\template.prf'
$csvFile = 'C:\TemplatePRF\mailbox.csv'
$outputDirectory = 'C:\TemplatePRF\New'
if (-not (Test-Path -Path $outputDirectory -PathType Container))
New-Item -Path $outputDirectory -ItemType Directory -ErrorAction Stop
$templateContents = Get-Content -Path $templateFile -ErrorAction Stop
Import-Csv -Path $csvFile |
ForEach-Object {
$record = $_
$newContents = $templateContents -replace '(?<=mailboxname\s*=\s*)%TEMPLATEPRFUSER%', $record.MailboxName
$newFile = Join-Path -Path $outputDirectory -ChildPath $record.PRFNAME
Set-Content -Path $newFile -Value $newContents -
How to create column header text while downloading file
How can we create column header text while downloading file using function GUI_DOWNLOAD(in SAP Release 4.6c) because there is no FIELDNAMES parameter in
4.6c version.Hii,
Check this sample code. I have called GUI_DOWNLOAD twice. Onetime to download header of table and next time data of table
REPORT z_file_download.
DATA: w_name(90) TYPE c.
DATA:
BEGIN OF fs_flight,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price LIKE sflight-price,
currency LIKE sflight-currency,
END OF fs_flight.
DATA:
BEGIN OF fs_head,
carrid(10) TYPE c,
connid(10) TYPE c,
fldate(10) TYPE c,
price(10) TYPE c,
curr(10) TYPE c,
END OF fs_head.
DATA:
t_head LIKE
TABLE OF
fs_head.
DATA:
t_flight LIKE
TABLE OF
fs_flight.
fs_head-carrid = 'CARRID'.
fs_head-connid = 'CONNID'.
fs_head-fldate = 'FLDATE'.
fs_head-price = 'PRICE'.
fs_head-curr = 'CURRENCY'.
APPEND fs_head TO t_head.
SELECT-OPTIONS:
s_carrid FOR fs_flight-carrid.
START-OF-SELECTION.
SELECT carrid
connid
fldate
price
currency
FROM sflight
INTO TABLE t_flight
WHERE carrid IN s_carrid.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'D:\flight.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = t_head
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'D:\flight.xls'
filetype = 'ASC'
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = t_flight
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc EQ 0.
MESSAGE 'Download successful' TYPE 'I'.
ENDIF.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Abhijeet -
Messages has replaced all my text with a load of letter A's in boxes. What is that all about. When I type a new one it is fine until I hit enter then the same thing applies. Has anyone a fix for this?
Picture below, many thanks for your help.
JasonBack up all data before proceeding.
Launch the Font Book application and validate all fonts. You must select the fonts in order to validate them. See the built-in help and this support article for instructions. If Font Book finds any issues, resolve them.
Start up in safe mode to rebuild the font caches. Restart as usual and test.
Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t start in safe mode. In that case, ask for instructions.
If you still have problems, then from the Font Book menu bar, select
File ▹ Restore Standard Fonts...
You'll be prompted to confirm, and then to enter your administrator login password.
Also note that if you deactivate or remove any built-in fonts, for instance by using a third-party font manager, the system may become unstable. -
Hi,
I have a text file with few lines. Please let me know hot to modify the text in in the line.
for example if my file contains :
this is line 1.
this is line two.
this is line 3.
now i want to replace 1 by one and 3 by three.
this is a simple example but my requirement is some other .
I tried opening the file reading the strings and comparing and changing and writting it to new file.
is there any way to directly open the file and modify without using the second file to be created.
Thanks in advance,
pavanthe actual problem is there is a file in following kind of entry in each line
<string>, starting point, ending point.
eg. "this is a file" , 10, 20.
now i want to calculate the length of the string and add to starting point and check with ending point if it is false then update the ending point with actual value. -
Rename files using text or excel file
I am trying to find out how to rename files on my pc using the names stored in a text document
eg. the file on the pc is called "C07_08.dat"
the text file has the following line "3am Eternal KLF 03:15 121 BMG C07.08"
i want to change the name of the file "C07_08.dat" to "3am Eternal.mpeg"
What I would like is a batch file or program or something that will see the text "C07.08" and find the corresponding file "C07_08.dat" and rename it "3am Eternal.mpeg"
I have managed to create a excel document that has the information in four separate columns
Column A has the name of the file I want to use (ie. 3am Eternal) Column B & C have unneeded information and Column D has the file reference (ie. C07.08)
I was told that Python or Visual basic could do this so I downloaded them but I have no experience with this so im lost as to what to do, I have over 1800 of these files so doing it file by file will take quite a while.
I have included a sample of the text file for reference if that helps
3am Eternal KLF 03:15 121 BMG C07.08
4 In The Morning Gwen Stefani 04:22 092 UMA HD1.10
4 Minutes Madonna ft J Timberlake 04:04 113 WAR HE3.05
5 6 7 8 Steps 03:24 000 BMG C48.03
5678 Steps 03:23 140 MUS H16.02
6 Of 1 Thing Craig David 03:15 116 WAR HE2.11
60 MPH New Order 03:51 125 WAR N57.11
7 Days Craig David 04:30 084 SHO N41.16
7 Things Miley Cyrus 03:29 107 EMI HE7.09
99 Luft Balloons Nena 03:58 095 WAR C27.10
99 Times Kate Voegele 03:27 112 UMA HG6.07
A Girl Like You Edwyn Collins 03:47 126 MDS R06.08
A Little Bit Pandora 03:35 132 UMA H23.01
A Little Less Conversation Elvis VS JXL 03:02 115 BMG H68.03
A Matter Of Trust Billy Joel 04:00 110 SON C59.11
A New Day Has Come Celine Dion 04:20 092 SON H65.20
A Woman Like You Mondo Rock 04:03 169 MUS R06.01
About You Now Sugababes 03:32 083 UMA HD5.08
Absolutely Everybody Vanessa Amorosi 03:52 124 TRA H40.06
Absolutely Fabulous Pet Shop Boys 03:45 132 EMI C15.02
Accidentally In Love Counting Crows 03:08 138 UMA H94.05
According To You Orianthi 03:18 066 UMA HG4.12
Achy Breaky Heart Billy Ray Cyrus 03:55 122 SON K11.02Here are two VBScripts that will rename the files based on the text file example you provided. The script that reads a
TEXT FILE requires each entry to be separated by
ONE TAB because it is the
TAB
that it uses to split each line into 4 parts (part1 - old file name, part2 and part3 - items you don’t need, part 4 - new file name). If there is more that one tab then the Split Function will not work properly.
The second VBScript will read the
EXCEL FILE row by row and use the values in Column A for the old file name and
Column D for the new file name. This approach will work much better if you have an excel document setup like this.
I used your example that you provided and it test fine for both approaches.
'Read text file
Dim objFSO, objFolder, inFile, strInLine, strOldFile, strNewFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Select the folder
Set objFolder = objFSO.GetFolder("C:\Scripts\MusicFiles")
'Open Text File
Set inFile = objFSO.OpenTextFile("C:\Scripts\MusicFiles.txt",1)
Do Until inFile.AtEndOfStream
'Read text file line by line and Split each line into 4 parts.
strInLine = Split(inFile.ReadLine, vbTab)
'Old File name
strOldFile = strInLine(3)
'new File name
strNewFile = strInLine(0)
'Loop through the files in the folder
For Each File In objFolder.Files
'If the file name matches the old file name above
If File.Name = strOldFile & ".dat" Then
'Replace it
File.Name = strNewFile & ".mpeg"
End If
Next
Loop
'Close the text reader
inFile.Close
MsgBox "Done."
'Read Excel file
Dim objFSO, objExl, objFolder, objWorkbook, strOldFile, strNewFile, intRow
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExl = CreateObject("Excel.Application")
'Select the folder
Set objFolder = objFSO.GetFolder("C:\Scripts\MusicFiles")
'Open the Excel file
Set objWorkbook = objExl.Workbooks.Open("C:\Scripts\MusicFiles.xls")
'Start at row 1
intRow = 1
'Read each Row until the end
Do Until objExl.Cells(intRow,1).Value = ""
'Old file name is in column 4
strOldFile = objExl.Cells(intRow, 4).Value
'New file name is in column 1
strNewFile = objExl.Cells(intRow, 1).Value
'Loop through each file in the selected folder
For Each File In objFolder.Files
'If the file name matches the old file name above
If File.Name = strOldFile & ".dat" Then
'Replace it
File.Name = strNewFile & ".mpeg"
End If
Next
'Increment each row
intRow = intRow + 1
Loop
'Close Excel
objExl.Quit
MsgBox "Done."
v/r LikeToCode....Mark the best replies as answers. -
Issue with deleting text from CSV file in Numbers
We are converting an Exel File into a CSV File by way of Numbers, in an effort to upload contacts into my Contacts database on my MacBook Air. The Contacts database does not like the CSV file and I am pretty sure it is because there is text in the phone number column. So a cell may read
"Office: 323.555.1212"
Before I change 600+ cells by manually taking out the word "cell" or "office" from these cells, I wonder if there is a way to format the column such that the text is ommitted. Thanks!Hi gergenson,
Find and Replace in Numbers.
Edit > Find > Show Search (command f) will bring up a search box:
Click on Find and Replace.
In the Find box, type Office: followed by two spaces (there are two spaces in your example).
Leave the Replace box empty.
Click on Replace All.
Repeat this for Cell.
That editing process will replace the Find text with nothing, and will leave the rest of the cell contents unchanged.
Regards,
Ian. -
Crystal Report with text(csv) data file, can we set it as input parameter?
Hi,
I am a new user of Crystal Reports 2008.
I have created a report with charts in it. The input data comes from a csv text file.
Can I set the name of this text file as an input parameter?
as I need to generate 44 similar reports with different text filenames(and data)?
Thank you.
RegardsBrian,
Thanks much.
I did exactly what you said.
Just to see any change, I first gave a bad report file name just to see if I am accidentally pointing to a different file,
but I got an error saying report not found.
Then I renamed my original datafile name and generated a report and it still generated one without giving an error.
Then I also gave a junk name to the logoninfo and printed that name, the new name was assigned to logoninfo, but the code did not error out.
It ended up generating the report.
Now here is what I think is happening,
1) The save data in report option seems to be still on even though I have turned it off in 2 locations
a) file -> Report Options
b) file -> Options -> Reporting tab.
2) For some reason the logoninfo is getting ignored as well.
Since I did not see any answers yesterday I posted a link to this thread on the .Net forum
Crystal Report with text(csv) data file, can we set it as input param? C#
and Ludek Uher says that I am connecting to the text file via a DAO database engine and so need to use the same code for changing the text file as for changing an Access database.
But the link he gave me tells me to try the same thing that we have been trying..
Here is my plan,
1) I will first try and find out why my save data with report option is still on ( but it shows off in Crystal ).
2) why is LogonInfo getting ignored.
Meanwhile any suggestions from anyone are welcome.
Maybe you are looking for
-
Each time I create a Text Frame it appears colored with black?
Every time I create a Text Frame with the Type tool in InDesing CS5.5 in a document named "02_End.indd", (this happen only for this file) the it appears filled with black color. On the other documents this does not happen (the text frames are with no
-
How to print customer Sales Invoice directly from FI module?
Hi, How to print customer Sales Invoice directly from FI module without using SD's t-code VF02 and VF03?
-
Join between Oracle and non-Oracle Database
We are working at a project with the follow architecture: - 5 Databases (3 Oracle, 1 Sybase and 1 DB2); - Session Bean like Session Facade Pattern; - Entity Bean (BMP); - OC4J (Oracle Container for J2EE); The case is that we cannot make join between
-
Is it possible to Email document into KM
We are trying to streamline a manual process where a user has to log into our Portal and deposit files in specific folders for use by other users. Is there a way to email a document directly into a KM Folder? Thanks for any ideas on this.
-
XML - Adobe ActionScript 3 (AS3 ) API Reference
This question was posted in response to the following article: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/XML.html