Solved

using sed to select csv field and remove first (leading) character

Posted on 2004-09-18
1
645 Views
Last Modified: 2013-12-05
Having exported data from an MS Access database to csv format I have now realised that the currency fields are in format ...,£1234.56,...

Once the csv file is shifted onto Linux and the command "head --lines=10 file.csv" is run the system seems incapable of reading the £ sign and it looks like a blank space.  However when I try and copy and paste any part of the output which contains the 'space' it will not function (any other part of the output can be copied and pasted).

Is there some way sed can strip this unknown character out of the csv, or is there alternatively some way to make Linux recognise this character correctly?

By the way, changing the fields to not be currency in MS Access is not an option.

Thanks in advance
0
Comment
Question by:MitchBroadhead
1 Comment
 
LVL 23

Accepted Solution

by:
Mysidia earned 125 total points
ID: 12092936
perl -pe 's/\243//g'   -i.bak  filename.csv

To use sed you'd need to embed the character

sed s/£//g

Try doing this inside a gnome-terminal or xterm instead of the console if that's what you're doing..

I guess you're using an older Linux distribution?
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now