Sponsored Content
Top Forums Shell Programming and Scripting How to strip apostrophe from a file Post 75821 by jim mcnamara on Wednesday 22nd of June 2005 10:07:48 AM
Old 06-22-2005
Sometimes tr is easier to use than sed for single characters:
Code:
cat filename | tr -s "\'" ' '

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to strip out the contents of file using grep

Hi, I am receving a file from remote site which has EDI information for 830, 862 and 997 and I want to extect the data for 997 using grep's or any other methods. The data look like this: ISA~000 0000-0001-1000~997 AK1000~m 000~IEA~M ISA~000 0000-0001-1000~849 000~IEA~M ISA~000... (11 Replies)
Discussion started by: isingh786
11 Replies

2. UNIX for Dummies Questions & Answers

How to strip the contants from a file

Hi, I have some EDI data which 830, 862 and 997. Here is the sample data: ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051215~184 3~U~00200~000011432~0~P~< GS~FA~TC11A~U1CAD~051215~1843~000011432~X~002002 ST~997~0001 AK1~SH~1168 AK2~856~11680001 AK5~A... (2 Replies)
Discussion started by: isingh786
2 Replies

3. Shell Programming and Scripting

how to strip rows from a text file?

Can an expert kindly write an efficient Linux ksh script that will strip rows with no numbers from a text file? Supposing there are three rows that text file called text.txt : "field1","field2","field3",11,22,33,44 "field1","field2","field3",1,2,3,4 "field1","field2","field3",,,, The... (5 Replies)
Discussion started by: ihot
5 Replies

4. Shell Programming and Scripting

strip first 4 and last 2 lines from a file using perl

Hi I have a file from which i need to remove the first 4 and the last 2 lines.. i know how to do it with sed but i need to do it in a perl script.. can you please help me how to do that. Thanks (10 Replies)
Discussion started by: meghana
10 Replies

5. UNIX for Dummies Questions & Answers

Strip time from date in a file

I have a couple of datetime fields in a file with contents like below: ICPBR|6373056085|1|O||||JOHN|SMITH|||H200|706|445668|||123 SMITH ST|LAGRANGE|IL|66666 |||||||N|N|N|N|N|||345676|2009.02.20-13:09:04|257655957|2009.02.20-13:09:04||||N|||||F||||||||||| I want to strip the time off the... (4 Replies)
Discussion started by: ChicagoBlues
4 Replies

6. Shell Programming and Scripting

Strip time from CSV File?

Hi, I've been trying (and failing miserably) all morning to strip from a CSV file the time from it. Can somebody point me in the right direction on how to do this using sed or awk? The file looks like: "James","07/20/2009-14:40:11" "Steve","08/06/2006-02:34:37"... (5 Replies)
Discussion started by: nmuntz
5 Replies

7. Shell Programming and Scripting

How to strip the spaces in file names?

please somebody tell me what is wrong with this, while the thumbnail grabbing works and encoding works, but what is not working is, mv $i.jpg /var/www/thumbs/ and mv $i.mp4 /var/www/uploads/ #!/bin/bash # MINT 9 - FFMPEG - QT-FASTSTART - X264 - MP4 DIR=/var/www/tmp for i in... (9 Replies)
Discussion started by: mysoogal
9 Replies

8. Shell Programming and Scripting

strip csv file

Hi everyone, I hope someone can help me: i am trying to get some info from a csv file, after i awk the column i need , i made a selection and output it in a file. now i need to get a list from this file, but i stuck with some fields. basically i have a text file with next data: 3... (3 Replies)
Discussion started by: lostym
3 Replies

9. Shell Programming and Scripting

Replace apostrophe with backslash apostrophe

I'm coding using BASH and have a requirement to replace apostrophes with backslash apostrophes. For example below: I am here 'in my room' ok Would be changed to: I am here /'in my room/' ok The original text is coming from a field in a MySql database and is being used by another process that... (5 Replies)
Discussion started by: dbjock
5 Replies
TR(1)							      General Commands Manual							     TR(1)

NAME
tr - translate characters SYNOPSIS
tr [ -cds ] [ string1 [ string2 ] ] DESCRIPTION
Tr copies the standard input to the standard output with substitution or deletion of selected characters (runes). Input characters found in string1 are mapped into the corresponding characters of string2. When string2 is short it is padded to the length of string1 by dupli- cating its last character. Any combination of the options -cds may be used: -c Complement string1: replace it with a lexicographically ordered list of all other characters. -d Delete from input all characters in string1. -s Squeeze repeated output characters that occur in string2 to single characters. In either string a noninitial sequence -x, where x is any character (possibly quoted), stands for a range of characters: a possibly empty sequence of codes running from the successor of the previous code up through the code for x. The character followed by 1, 2 or 3 octal digits stands for the character whose 16-bit value is given by those digits. The character sequence followed by 1, 2, 3, or 4 hexadecimal digits stands for the character whose 16-bit value is given by those digits. A followed by any other character stands for that character. EXAMPLES
Replace all upper-case ASCII letters by lower-case. tr A-Z a-z <mixed >lower Create a list of all the words in one per line in where a word is taken to be a maximal string of alphabetics. String2 is given as a quoted newline. tr -cs A-Za-z ' ' <file1 >file2 SOURCE
/sys/src/cmd/tr.c SEE ALSO
sed(1) TR(1)
All times are GMT -4. The time now is 07:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy