Sponsored Content
Full Discussion: Encoding troubles
Top Forums Shell Programming and Scripting Encoding troubles Post 302366491 by tukuyomi on Thursday 29th of October 2009 04:15:52 PM
Old 10-29-2009
Encoding troubles

Hello All

I have a set of files, each one containing some lines that follows that regex:
Code:
regex='disabled\,.*\,\".*\"'

and here is what file says about each files:
Code:
file <random file>
<random file> ASCII text, with CRLF line terminators

So, as an example, here is what a file ("Daffy Duck - The Marvin Missions (USA).cht" is its name) says:
Code:
disabled,C283-3D6F,"Invincibility" 
disabled,DFBD-1DA4,"Start with 1 life" 
disabled,DBBD-1DA4,"Start with 9 lives (don't set lives in options menu)" 
disabled,49BD-1DA4,"Start with 25 lives (don't set lives in options menu)" 
disabled,9FBD-1DA4,"Start with 51 lives (don't set lives in options menu)" 
disabled,DDB3-3404,"Infinite lives" 
disabled,DDA8-4466,"Extra lives cost $500" 
disabled,DFA8-4466,"Extra lives cost $1,500"

It's not visible on this forum, but I have a character encoding problem on the `'` on lines 3-5
In order to check the syntax of each file, I wrote a small bash script (see below) that check each line against the regex above. But due to this small encoding problem, my script echoes those lines although they match the regex.
My script:
Code:
#!/bin/bash

regex='disabled\,.*\,\".*\"'
for f in *cht; do
    while read line; do
        if [[ ! "${line}" =~ ${regex} ]]; then
            echo "$f - $line"
        fi
    done < "$f"
    
done

exit 0

stdout:
Code:
Daffy Duck - The Marvin Missions (USA).cht - disabled,DBBD-1DA4,"Start with 9 lives (don�t set lives in options menu)"
Daffy Duck - The Marvin Missions (USA).cht - disabled,49BD-1DA4,"Start with 25 lives (don�t set lives in options menu)"
Daffy Duck - The Marvin Missions (USA).cht - disabled,9FBD-1DA4,"Start with 51 lives (don�t set lives in options menu)"

Any advices to get rid of those � (replacing is not an option)? Thank you for reading.
 

10 More Discussions You Might Find Interesting

1. Programming

compiling troubles

i keep getting the following error with the code segment below when i try to compile the program. The code is from 'defs.h' parse error before '(' parse error before ')' stray '\' in program this is the code segment and the error is on the second line of the segment #define... (1 Reply)
Discussion started by: token
1 Replies

2. HP-UX

cron troubles

I have a cronjob that I need to run everyday and it needs to have todays date inputed, here is what I have, but is not working as expected.......... 23 02 * * * cd /path;./RequestSummaryReport.sh $(date +%Y-%m-%d) the output from mail gives me............. Date: Fri, 8 Feb 2008 02:12:07... (4 Replies)
Discussion started by: theninja
4 Replies

3. Shell Programming and Scripting

if-statement troubles

I try to compare the day and month of someones birthday with the day and month of today, so my little bash script can send a mail to the person that has its birthday that day. The first line of the file birthdays looks like this: firstname,lastname,01/01/1990,.... The variable birthday's... (4 Replies)
Discussion started by: doc.arne
4 Replies

4. UNIX for Dummies Questions & Answers

Cron troubles

I am aware this question has been answered time and again. I feel I have tried everything I have seen on the net and really need help to get this working. Same old story. Shell script, working from command but not from cron. I need my script to take values from a .properties file. Tried... (2 Replies)
Discussion started by: airalpha
2 Replies

5. Shell Programming and Scripting

for loop troubles

What I have here is a pretty textbook recursive function. Its purpose right now is simply to display all folders that don't contain folders. It works fine in all instances I can think of... except one. If there is a folder with a space in its name, the thing goes Kablooie. AFAIK the problem comes... (5 Replies)
Discussion started by: divisionbyzero
5 Replies

6. Shell Programming and Scripting

How to find the file encoding and updating the file encoding?

Hi, I am beginner to Unix. My requirement is to validate the encoding used in the incoming file(csv,txt).If it is encoded with UTF-8 format,then the file should remain as such otherwise i need to chnage the encoding to UTF-8. Please advice me how to proceed on this. (7 Replies)
Discussion started by: cnraja
7 Replies

7. Shell Programming and Scripting

awk and tr troubles

I am trying to make all the fields containing lower case letters upper case and the third field of a file display ** instead. I have this: awk '{printf "%s %s ** %d %d\n", $1, $2, $4, $5}' database.txt | tr '' '' < database.txt And that only changes it to upper case, other... (4 Replies)
Discussion started by: Bungkai
4 Replies

8. BSD

PF troubles on OpenBSD 5.0

I am setting up a system as an ADSL gateway. ADSL is working fine. PF is not forwarding for some reason. # ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33196 priority: 0 groups: lo inet6... (0 Replies)
Discussion started by: John Tate
0 Replies

9. UNIX for Advanced & Expert Users

Troubles with OpenSSH

Hi, I am trying to login from one AIX server to another without using a password, a basic configuration, however it doesn't seem to work. All things are in place. I have both a public and private key in the ~/.ssh folder and also have an "authorized_keys" file on the target-server containing... (5 Replies)
Discussion started by: Hille
5 Replies

10. Solaris

View file encoding then change encoding.

Hi all!! I´m using command file -i myfile.xml to validate XML file encoding, but it is just saying regular file . I´m expecting / looking an output as UTF8 or ANSI / ASCII Is there command to display the files encoding? Thank you! (2 Replies)
Discussion started by: mrreds
2 Replies
lives(1)						      General Commands Manual							  lives(1)

NAME
LiVES - LiVES is a Video Editing System SYNOPSIS
lives <video_file> <start_time> <frames> [ -help ] [ -version ] [ -set setname | -noset ] [ -nogui ] [ -aplayer ap ] [ -jackopts opts ] [ -norecover | -recover ] [ -oscstart port | -nooscstart ] [ -devicemap mapfile ] DESCRIPTION
This manual page documents briefly the lives command. LiVES lets you start editing and making video right away, without having to worry about formats, frame sizes, or framerates. LiVES will let you start creating your own tools, utilities and effects via the built in RFX builder. OPTIONS
-help Show all commandline options and exit -version Print the version, copyright and licensing details, and exit -set setname Start up lives and autoload set setname -noset Do not load any set on startup -nogui Do not show the GUI (experimental) -aplayer ap Start with selected audio player. ap can be mplayer, sox or jack. Note: This sets the audio player permanently. You can change it in preferences. -jackopts opts opts is a bitmap of jack startup options [1 = jack transport client, 2 = jack transport master, 4 = start jack transport server, 8 = pause audio when video paused, 16 = start jack audio server] Note: jackopts are temporary, only for this instance. You need to set them in Preferences if you want to make permanent changes. -norecover Force no loading of crash recovery -recover Force loading of crash recovery (if present) -oscstart port Start OSC listener on UDP port port if LiVES is compiled with OSC support -nooscstart Do not start OSC listener -devicemap mapfile Load in device mapping file mapfile at startup SEE ALSO
mplayer(1), ImageMagick(1), ffmpeg(1). AUTHOR
lives was written by Gabriel "Salsaman" Finch. This manual page was originally written by Gurkan Sengun <gurkan@phys.ethz.ch>, for the Debian project (but may be used by others). This man page has been updated by Gabriel "Salsaman" Finch <salsaman@xs4all.nl> and Harry Rickards <harry@linux.com> November 12, 2007 lives(1)
All times are GMT -4. The time now is 06:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy