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

<UUOC police>
tr -s "\'" ' ' < filename
</UUOC police>
 

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
paste(1)						      General Commands Manual							  paste(1)

NAME
paste - Joins corresponding lines of several files or subsequent lines in one file SYNOPSIS
paste [-d list] [-s] file... STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: paste: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Replaces the delimiter that separates lines in the output (tab by default) with one or more characters from list. If list contains more than one character, then the characters are repeated in order until the end of the output. In parallel merging, the lines from the last file always end with a newline character, instead of one from list. The following special characters can be used in list: Newline character Tab Backslash Empty string (not a null character) [Tru64 UNIX] An extended character You must quote characters that have special meaning to the shell. Merges all lines from each input file into one line of output (serial merging). Using this option, the paste command merges all lines in the first input file forcing a newline before at the end. The command then continues with the next input file, continuing in the same manner until all input files have been completed. A tab separates the input lines unless you use the -d option. Regardless of the list, the last character of the output is a newline character. OPERANDS
The name of an input file. You may specify up to 12 files, including hyphens. If you specify a -, paste reads standard input recursively, one line for each -. DESCRIPTION
Specifying the -d option or no options causes the paste command to treat each file as a column, joining them horizontally with a tab char- acter by default (parallel merging). Using the -s option, the paste command combines all lines of each input file into one output line (serial merging). These lines are joined with the tab character by default. Output lines can be any length. [Tru64 UNIX] The output of pr -t -m is similar to the output produced by the paste command, but pr with its options creates extra spaces, tabs, and lines for an enhanced page layout. RESTRICTIONS
If the -s option is not used, it is an error if any specified file cannot be opened. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
To paste several columns of data together, enter: paste names places dates > npd This creates a file named npd that contains the data from names in one column, places in another, and dates in a third. The columns are separated by tab characters. File npd then contains: rachel New York 28 February jerzy Warsaw 27 April mata Nairobi 21 June michel Boca Raton 27 July segui Managua 18 November A tab character separates the name, place, and date on each line. To separate the columns with a character other than a tab (sh only), enter: paste -d"!@" names places dates > npd This alternates the apostrophe (!) and the at sign (@) as the column separators. If names, places, and dates are the same as in Example 1, then npd contains: rachel!New York@28 February jerzy!Warsaw@27 April mata!Nairobi@21 June michel!Boca Raton@27 July segui!Managua@18 November To dis- play the standard input in multiple columns, enter: ls | paste - - - - This lists the current directory in four columns. Each hyphen (-) tells the paste command to create a column containing data read from the standard input. The first line is put in the first column, the second line in the second column, ... and then the fifth line in the first column, and so on. This is equivalent to ls | paste -d" " -s - which fills the columns across the page with subsequent lines from the standard input. The -d defines the character to insert after each column: a tab character ( ) after the first three columns, and a newline character ( ) after the fourth. Without the -d option, paste -s - displays all of the input as one line with a tab between each column. To merge the lines of the file names above into one output line, enter: paste -s names This results in: rachel jerzy mata michel segui ENVIRONMENT VARIABLES
The following environment variables affect the execution of paste: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments and input files). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cut(1), grep(1), fold(1), join(1), pr(1) Standards: standards(5) paste(1)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy