Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Remove whitespaces between delimiter and characters Post 303015725 by Don Cragun on Wednesday 11th of April 2018 01:40:02 AM
Old 04-11-2018
Hi amvip,
Your requirements are still a little bit ambiguous...

If there are one or more spaces before the 1st pipe symbol or after the last pipe symbol and there are no characters other than spaces in those fields; are those spaces supposed to be removed, are they supposed to be changed to a single zero character, or are they to be left unchanged? Of your three rules, the first two rules do not apply because the data field is not "between delimiters" and the third rule doesn't apply because there are no characters in the field other than spaces.

The code RudiC suggested in post #4 will turn leading and trailing fields containing only spaces into empty fields. Is that what you want?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help me to remove the whitespaces between the lines ...urgent

Hello all, i have a problem. please help me to remove the white spaces and tabs betweeen line. i.e., file1 contains some text.. text starts_hdsffdsd sdfsddssdds******** sdfsdsd*********** sdfsdsdfsdsdfsdsds*** ****fsd_test_ends one or 2 blank lines (* indicates white spaces or tabs) ... (5 Replies)
Discussion started by: kumar1
5 Replies

2. Shell Programming and Scripting

Formatting a text file based on newline and delimiter characters

Hi Everybody, I need some help on formatting the files coming into unix box on the fly. I get a file some thing like this in a single line. ISA^M00^M ^M00^M ^M14^M006929681900 ^M01^M095449419 ... (5 Replies)
Discussion started by: ntekupal
5 Replies

3. UNIX for Dummies Questions & Answers

Remove whitespaces between comma separated fields from file

Hello all, I am a unix dummy. I am trying to remove spaces between fields. I have the file in the following format 12332432, 2345 , asdfsdf ,100216 , 9999999 12332431, 2341 , asdfsd2 ,100213 , 9999999 &... (2 Replies)
Discussion started by: nitinbjoshi
2 Replies

4. Shell Programming and Scripting

Remove spaces before a delimiter

Hi All, I need to modify a script to remove spaces from a csv file. The csv file is delimited by the '~' character and I need to remove the spaces which appear before this character. i.e Sample input: LQ001 SWAT 11767727 ~9104 ~001 ~NIRSWA TEST 18 ~2 ~Standard Test ~0011 Desired... (5 Replies)
Discussion started by: SRyan84
5 Replies

5. Shell Programming and Scripting

Multiple characters including single quote in delimiter

Hello, I need to replace the comma to something else between the single quote: 1aaa,bbb,'cc,cc','ddd',1 2aaa,bbb,'ccc','d,d',0 to 1aaa,bbb,'cc<comma>cc','ddd',1 2aaa,bbb,'ccc','d<comma>d',0 Can someone help? Thanks. (2 Replies)
Discussion started by: bgirl
2 Replies

6. Shell Programming and Scripting

Remove whitespaces in the n first characters?

I assume removing whitespaces in the n first characters of a string would be an easy task for sed? If so, how? (7 Replies)
Discussion started by: KidCactus
7 Replies

7. Shell Programming and Scripting

remove delimiter

hy all, i need case with input like this 1::||10334|11751| 2::10324|17541||| i want output like this 1::||1033411751| 2::1032417541||| how i can do that for get like output thx before your advice (3 Replies)
Discussion started by: zvtral
3 Replies

8. UNIX for Dummies Questions & Answers

Remove text in particular delimiter

I have input file like this 551|552|553|554|555|556|557|558|559|560 I need any one offset need to be blank for eg. 551|552|553||555|556|557|558|559|560 My Shell is csh (1 Reply)
Discussion started by: nsuresh316
1 Replies

9. UNIX for Dummies Questions & Answers

Remove Extra Delimiter

Hi , I have file like this.. aaa|bbbb|cccc|dddd|fff|dsaaFFDFD| Adsads|sas|sa|as|asa|saddas|dsasd|sdad| dsas|dss|sss|sss|ddd|dssd|rrr|fddf| www|fff|refd|dads|fsdf|00sd| 5fgdg|dfs00|d55f|sfds55|445fsd|55ds|sdf| so I do no have any fix pattern and I want to remove extra... (11 Replies)
Discussion started by: pankajchaudhari
11 Replies

10. UNIX for Advanced & Expert Users

How to remove the delimiter from the column value within a file?

Hello All, we have some 10 files wherein we are using the ASCII NULL as separator which is nothing but '^@' and we need to change it to pipe delimited file before loading to database. Most of the data seems to be fine but there are instances where this separator tends to appear in the middle of... (9 Replies)
Discussion started by: dJHa
9 Replies
lltag_formats(5)						File Formats Manual						  lltag_formats(5)

NAME
formats - Internal formats database file for lltag DESCRIPTION
The internal format database is usually stored in /etc/lltag/formats. The user may override this file by defining a $HOME/.lltag/formats. If this file exists, the system-wide one is ignored. These files contain entries starting with a line such as: [%n - %a - %t] A title between bracket that will be displayed at runtime. Then, the following 3 lines must be given to explain how the format is actually used to parse filenames: type = basename The type is either basename (to parse the last part of the path to a file) or path (to parse the directory part of the path to a file). When actually parsing the path to target files, basename and path parsers will be assembled. All possible combination will be tried. regexp = %L%N%S-%S%A%S-%S%A%L A string composed of any characters, with the following special fields: %L for delimiter (empty by default, multiple spaces if --spaces was given) %S for a space (or multiple spaces if --spaces was given) %N for numbers %A for an alphanumeric string without / %P for any path (alphanumeric string with /) %% for % indices = NUMBER,ARTIST,TITLE A list of fields to match (either given by their full name or associated letter) corresponding to each %N or %A field in the previ- ous format. It may be AUTHOR (or a), ALBUM (A), GENRE (g), NUMBER (n), TITLE (t), DATE (d), COMMENT (c) or IGNORE (i). See also FORMAT in the manpage of lltag for details about these fields. SEE ALSO
lltag(1) AUTHOR
Brice Goglin NOVEMBER 2006 lltag_formats(5)
All times are GMT -4. The time now is 08:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy