Solved

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

Posted on 2004-09-18
1
644 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

12 Experts available now in Live!

Get 1:1 Help Now