Sponsored Content
Top Forums Shell Programming and Scripting Replacing all but last Hex characters in a text line Post 49141 by BAH on Friday 26th of March 2004 03:00:23 AM
Old 03-26-2004
Removing or Replacing CR/LF characters (hex 0D and 0A) in MS Access Memo/Text Fields

This is just an FYI to help anybody that might be in a similar situation. I did not have to write or execute any UNIX script to remove these troublesome CR/LF hex characters from the text in several fields in one of my MS Access tables.
First of all, the MS Access Table in question is actually linked via an ODBC connection to an MS SQL Server database.
After establishing the link and being able to view the data, I export the data using the tilde (~) as the delimiter and using the quote (") to surround text fields .... and save the file as a type .txt or.csv file. I made sure that the tilde did not exist in the Table prior to selecting it as my delimiter.
Once the export file was created, I used an awesome tool which I found and downloaded from the internet to edit out the CR/LF characters.
The hex editor tool used is called XVI32. Link provided here: http://www.chmaas.handshake.de/delph...vi32/xvi32.htm
Since MS Access also puts out CR/LF characters as it exports the data, I had to find some unique sequence of characters either from the end of the record ... or the beginning of the record that is on either side of the hex 0D 0A that MS Access puts at the end of each exported record. I then performed a hex replace of the sequence of characters with some other unique sequence of characters.
For example: the sequence of characters I found to be unique were: 73 65 71 75 65 6E 63 65 0D 0A
The 0D 0A shown here was actually put there by Access.
The tool allowed me to change this sequence to: 73 65 71 75 65 6E 63 65 7C 7C
I replaced the 0D 0A with a 7C 7C.
The hex 7C character (shift-\) did not previously exist in the Table either.
After that completed, I am then able to delete (or replace) any other occurrence of 0D or 0A that exist in the file .... i.e. the occurrences that I want to remove/replace that exist in the free text fields of the record.
Now, once that completed, I then change back the sequence of characters from 73 65 71 75 65 6E 63 65 7C 7C to 73 65 71 75 65 6E 63 65 0D 0A.
I then save the file (with a new name ... just 2B safe). I now have a .txt file that MS Access will be able to re-import correctly ... or just link to ... as desired.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing characters in file with line break

Hi, Apologies if this has been asked before, but I searched and was not able to find an answer. It's probably a simple question to answer for those of you with some experience, though... I have a relatively long string where tokens are separated by the colon (':') character. Let's say the... (10 Replies)
Discussion started by: johnemb
10 Replies

2. Shell Programming and Scripting

replacing certain characters with new line?

i have a text file which domains something like this 123213213213/32434342 324324324/12312321321 12321321,435435435 12321312 / 12313213 / 12435435345 4353213 , 123213213213 21321321312-12334324 234324324 - 235645645645 456456456 - 45456456456 - 45645645654243 how can i replace '/' and... (4 Replies)
Discussion started by: Bashar
4 Replies

3. Shell Programming and Scripting

Replacing hex characters '\x0D' with '\x0D\x0A'

Hello All, I have a requirement where I need to replaced the hex character - '\x0D' with 2 hex characters - 'x0D' & 'x0A' I am trying to use SED - But somehow its not working. Any pointers? Also the hex character '\x0D' can occur anywhere in the line. Can this also be accomplished... (6 Replies)
Discussion started by: paragkalra
6 Replies

4. Shell Programming and Scripting

Replacing text/characters in vi

ok, so i have the following text to replace but it's not working. can someone please help me out: :%s~awk '// {split($2,s,",");a=$1 FS s} /-/ {b=a} END{print b}'~tail -1~g I want to replace the entire awk command with tail -1. thanks (7 Replies)
Discussion started by: SkySmart
7 Replies

5. UNIX for Dummies Questions & Answers

Replacing hex characters

I have the following file consisting of dates and sample measurements: 05��Oct��2010 1.31�� 06��Oct��2010 1.32�� 07��Oct��2010 1.31�� The hex characters are \xc2\xa0 in sequence. I have tried to remove the characters as follows: sed -i '' -e 's/\xc2\xa0//g' file.dat and as follows... (6 Replies)
Discussion started by: figaro
6 Replies

6. Shell Programming and Scripting

Replacing text on every third line

I have file like this "copy table_name from filea.txt on node replace delimiter '|';" "copy table_name from fileb.txt on node replace delimiter '|';" "copy table_name from filec.txt on node replace delimiter'|';" "copy table_name from filee.txt on node replace delimiter '|';" "copy... (1 Reply)
Discussion started by: nnani
1 Replies

7. Shell Programming and Scripting

Replacing text in Perl given by command line

Hi I need to write a Perl script that the file given as first argument of the command line that will find all occurrences of the string given as the third argument of the command line and replace with the string given as the fourth argument. Name newfound file is specified as the second... (3 Replies)
Discussion started by: nekoj
3 Replies

8. Shell Programming and Scripting

Replacing end of line characters

Hello, I'm looking for some help in renaming data-timestamps stored within different calendar directories/files. The calendar directory has hundreds of ICS files: ~/Library/Calendars/F494C908.calendar/Events/92B65E439AAC.ics ~/Library/Calendars/F494C908.calendar/Events/DE7867E61969.ics... (8 Replies)
Discussion started by: Schubi
8 Replies

9. HP-UX

Replacing Hex Characters In A File Using awk?

Hi guys, First off, i'm a complete noob to UNIX and LINUX so apologies if I don't understand the basics! I have a file which contains a hex value of '0D' at the end of each line when I look at it in a hex viewer. I need to change it so it contains a hex value of '0D0A0A' I thought... (10 Replies)
Discussion started by: AndyBSG
10 Replies

10. Shell Programming and Scripting

Checking and replacing first line in text file, one-liner?

Hello, I'm looking to check only the first line of a file to see if it is a format string, like # -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -\*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2if the first line is anything else, insert the above string. I'd... (3 Replies)
Discussion started by: f77hack
3 Replies
PPPDUMP(8)						      System Manager's Manual							PPPDUMP(8)

NAME
pppdump - convert PPP record file to readable format SYNOPSIS
pppdump [ -h | -p [ -d ]] [ -r ] [ -m mru ] [ file ... ] DESCRIPTION
The pppdump utility converts the files written using the record option of pppd into a human-readable format. If one or more filenames are specified, pppdump will read each in turn; otherwise it will read its standard input. In each case the result is written to standard out- put. The options are as follows: -h Prints the bytes sent and received in hexadecimal. If neither this option nor the -p option is specified, the bytes are printed as the characters themselves, with non-printing and non-ASCII characters printed as escape sequences. -p Collects the bytes sent and received into PPP packets, interpreting the async HDLC framing and escape characters and checking the FCS (frame check sequence) of each packet. The packets are printed as hex values and as characters (non-printable characters are printed as `.'). -d With the -p option, this option causes pppdump to decompress packets which have been compressed with the BSD-Compress or Deflate methods. -r Reverses the direction indicators, so that `sent' is printed for bytes or packets received, and `rcvd' is printed for bytes or pack- ets sent. -m mru Use mru as the MRU (maximum receive unit) for both directions of the link when checking for over-length PPP packets (with the -p option). SEE ALSO
pppd(8) 1 April 1999 PPPDUMP(8)
All times are GMT -4. The time now is 07:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy