Sponsored Content
Top Forums UNIX for Advanced & Expert Users Processing extended ascii character file names in UNIX (BASH scipts) Post 302168160 by robotronic on Sunday 17th of February 2008 11:05:17 AM
Old 02-17-2008
If you can't echo the extended characters maybe you should check the character encoding you're using in your environment (like utf8, iso8859-1, cp1252 ...).

Codes greater than 127 displays different characters depending on the locale settings. On my system if I set encoding to iso8859-1 (Western European) or cp1252 (WinLatin1) the code "\0366" corresponds to the special "o" character you've mentioned (ö), while with utf8 isn't recognized. With utf8 that character is multibyte (2 bytes) and for echoing that I do:

Code:
echo -e "\0303\0266"

About the cp command, I confirm that you cannot use that syntax: you may set a variable containing the complete pathname and pass that to cp, e.g.:

Code:
x=$(echo -e "/Library/Application Support/MakeMusic/Finale 2008/Komponenter/Jazz filf\0366rval")

cp -R -n -p "$x" "/Applications/Finale 2008/Komponentfiler"

If you have a text file containing that special character and you want to be absolutely sure of the octal code you have to use, try this procedure: make a copy of the file, edit it and leave in the file only that single character, then save and execute:

Code:
od -t oC -An input_file

For each character it prints out the octal code. In my case (I use echo instead of the input file):

With iso8859-1 encoding:
Code:
test ~ $ echo -e "ö" | od -t oC -An
 366 012

With utf8 encoding:
Code:
test ~ $ echo -e "ö" | od -t oC -An
 303 266 012

Notice that the output includes a trailing newline (\0012).
 

10 More Discussions You Might Find Interesting

1. Programming

Extended ascii

Hi all, I would like to change the extended ascii code ( 128 - 255). I tried to change LC_ALL and LANG in current session ( values from locale -a) and for no good. Thanks. (0 Replies)
Discussion started by: avis
0 Replies

2. Shell Programming and Scripting

Weird Ascii characters in file names

Hi. I have files in my OS that has weird file names with not-conventional ascii characters. I would like to run them but I can't refer them. I know the ascii # of the problematic characters. I can't change their name since it belongs to a 3rd party program... but I want to run it. is there... (2 Replies)
Discussion started by: yamsin789
2 Replies

3. Shell Programming and Scripting

extended ascii problem

hi i would like to check text files if they contain extended ascii characters within or not. i really dont have any idea how to start your kind help would be very much appreciated thanks. (7 Replies)
Discussion started by: smooth
7 Replies

4. Shell Programming and Scripting

read in a file character by character - replace any unknown ASCII characters with spa

Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/ Thanks! (1 Reply)
Discussion started by: raghav525
1 Replies

5. AIX

Printing extended ASCII

Hi All, I'm trying to send extended ascii characters to my HP2055 as part of PCL printer control codes. What I want to do is select a bar code font, print the bar code and reset the printer to the default font. Selecting the bar code font works good. Printing the bar code goes almost ok too. ... (5 Replies)
Discussion started by: petervg
5 Replies

6. Shell Programming and Scripting

Preserve extented ascii character when run echo comand inside bash script

Hi everyone, I'm echo some text with extended ascii characters as below: echo -e "Pr\xE9sentation du spectacle" > output or echo -e "Présentation du spectacle" > outputIf I open the file created I see this text Présentation du spectacleThe text is shown correctly in this created file when... (7 Replies)
Discussion started by: Ophiuchus
7 Replies

7. Shell Programming and Scripting

Identify extended ascii characters in a file

Hi, Is there a way to identify the lines in a file having extended ascii characters and display the same? For instance I have a file abc.txt having below data aaa|bbb|111|This is first line aaa|bbb|222|This is secõnd line aaa|bbb|333|This is third line aaa|bbb|444|This is foùrth line... (3 Replies)
Discussion started by: decci_7
3 Replies

8. Shell Programming and Scripting

Removal Extended ASCII using awk

Hi All, I am trying to remove (SELECTIVE - passed as argument) Extended ASCII using Awk based on adhoc basis. Can you please let me know how to do it. I have to implement this using awk only. Thanks & Regads (14 Replies)
Discussion started by: tostay2003
14 Replies

9. UNIX for Beginners Questions & Answers

Convert ascii character values to number that comes between the numbers in UNIX

I have variable that contains multiple values of number and also include overpunch(i.e. # $ % etc) character so we want to replace it with numbers. here are the example: Code: 11500#.0# 28575$.5$ 527#.7# 42".2" 2794 .4 2279!.9! 1067&.7& 926#.6# 2279!.9! 885".5" 11714$.4$ 27361'.1'... (1 Reply)
Discussion started by: nadeemrafikhan
1 Replies

10. UNIX for Beginners Questions & Answers

Print byte position of extended ascii character

Hello, I am on AIX. When I encounter extended ascii characters and special characters on a file I need to print.. Byte position, actual character and line number. Is there a simple command that can give me the above result ? Thanks in advance (38 Replies)
Discussion started by: rosebud123
38 Replies
pkgutil(1)						    BSD General Commands Manual 						pkgutil(1)

NAME
pkgutil -- Query and manipulate Mac OS X Installer packages and receipts. SYNOPSIS
pkgutil [options] [commands] DESCRIPTION
pkgutil reads and manipulates Mac OS X Installer flat packages, and provides access to the ``receipt'' database used by the Installer. Options are processed first, and affect the operation of all commands. Multiple commands are performed sequentially in the given order. The files and directories where receipts are stored are subject to change. Always use pkgutil to query or modify them. OPTIONS
--help, -h A brief summary of commands and usage. --force, -f Don't ask for confirmation before performing a potentially destructive or ambiguous operation. --verbose, -v Output in a "human-readable" format with extra headers, footers, indentation, and other contextual information. --volume path Perform all operations on the specified volume or home directory. The root volume '/' will be used if unspecified. --edit-pkg package-id Specifies an existing receipt to be modified in-place by --learn. --only-files List only files (not directories) in --files listing. --only-dirs List only directories (not files) in --files listing. --regexp Try to match package-id arguments as a regular expression if an exact match isn't found. See egrep(1) and re_format(7) for syn- tax. RECEIPT DATABASE COMMANDS
--packages, --pkgs List all installed package IDs on the specified --volume. --pkgs-plist List all installed package IDs on the specified --volume in Mac OS X plist(5) format. --pkgs=REGEXP List all installed package IDs matching REGEXP on the specified --volume. The equal sign (=) is required or the search string will be ignored and all package IDs will be returned. Be mindful of escaping characters in both your shell and the regular expression. (Eg, 'pkgutil --pkgs=\.D' searches for package IDs matching the literal '.D' after escaping the backslash from your shell and then the dot from the regex to make it literal.) Regular expressions are more complex than simple shell globbing. A dot (.) matches any character, while '*' matches zero or more of the previous character. See re_format(7) for a complete description of the syntax. --files package-id List all of the files installed under the package-id. --export-plist package-id Print all receipt information about the specified package-id in the standard Mac OS X plist(5) format. --pkg-info package-id Print extended information about the specified package-id. --pkg-info-plist package-id Print extended information about the specified package-id in Mac OS X plist(5) format. --forget package-id Discard all receipt data about package-id, but do not touch the installed files. DO NOT use this command from an installer pack- age script to fix broken package design. --learn path Update the ACLs of the given path in the receipt identified by --edit-pkg. This affects subsequent repair operations on the package. This command cannot be used from package postinstall scripts, but if a postinstall script changes the ACLs on the installed files, the receipt is automatically be updated to reflect those changes. This command will not update the filesystem permissions in the receipt. --pkg-groups package-id List all of the package groups this package-id is a member of. --groups List all of the package groups on the specified --volume. --groups-plist List all of the package groups on the specified --volume in Mac OS X plist(5) format. --group-pkgs group-id List all of the packages that are members of this group-id. --file-info path Show the metadata known about path. --file-info-plist path Show the metadata known about path in Mac OS X plist(5) format. FILE COMMANDS
--expand pkg-path dir-path Expand the flat package at pkg-path into a new directory specified by dir-path. --flatten dir-path pkg-path Flatten the dir-path into a new flat package created at pkg-path. The directory to be flattened must have the proper contents and layout for a flat package. This is not intended as a substitute for pkgbuild(1). --bom path Extract any BOM files from the flat pkg at path into /tmp and return the filename(s). Suggested use is as an argument to lsbom(8). Eg, "lsbom `pkgutil --bom path`". Note that some flat package archives may contain no BOM, one BOM, or several BOMs. --payload-files path List the files archived within the payload of the uninstalled flat package(s) contained at path. This should be equivalent to "lsbom -s `pkgutil --bom path`". Note that flat package archives may contain more than one package, and the destination location for the uninstalled package(s) is unknown to this command. --check-signature pkg-path Check the validity and trust of the signature on the package at pkg-path. In addition to the status of the signature, the asso- ciated certificate chain will be shown. SEE ALSO
installer(8) pkgbuild(1) productbuild(1) Mac OS March 2, 2011 Mac OS
All times are GMT -4. The time now is 10:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy