Sponsored Content
Top Forums Shell Programming and Scripting Special character replacement Post 303037827 by rohit_shinez on Wednesday 14th of August 2019 10:15:17 AM
Old 08-14-2019
Quote:
Originally Posted by rohit_shinez
Hi Guys,
I have a file which needs to be replaced with tab delimited

Code:
AA§Orgin Name§Mapping based on prod_usa§§§§
BB§Date§2019-08-11 23:30:01§§§§

I am trying below code

Code:
sed 's/[ -~ ^]/ /g' test.txt

Expected
Code:
AA|Orgin Name|Mapping based on prod_usa|||
BB|Date|2019-08-11 23:30:01||||


Yes you are correct it should be |||| , and is there a generic way to replace the special characters apart from §, I mean if I get any other special character

Last edited by rbatte1; 08-14-2019 at 01:33 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed in character replacement in Korn Shell

How do I replace a space " " character at a particular position in a line? e.g. I have a file below $ cat i2 111 002 A a 33 0011 B c 2222 003 C a I want all the 1st spaces to be replaced with forward slash "/" and the 3rd spaces to have 5 spaces to get the output below: 111/002... (8 Replies)
Discussion started by: stevefox
8 Replies

2. Shell Programming and Scripting

Character replacement

Hi, I am working on a command that replaces some occurrences of quotation marks in file. The quotation mark cannot be the first or the last character in line and cannot be preceded or followed by a comma. I am not an expert in regular expressions, but I managed to create the following... (2 Replies)
Discussion started by: piooooter
2 Replies

3. Shell Programming and Scripting

KSH - Character Replacement

Hey all. Easy question. I have a (ksh) varaible x. It contains the following (for example): N557788 I want to replace the "N" with a "-". I've done this before but for the life of me I cannot remember how I did it. Thanks. mtw (2 Replies)
Discussion started by: mixxamike
2 Replies

4. Shell Programming and Scripting

Sed-Special character replacement

Hi I want to replace ./testsed.ksh with testsed.ksh ./ is to be removed scriptnm=`sed -e 's/\.///' $0 does not work Please help (3 Replies)
Discussion started by: usshell
3 Replies

5. UNIX for Dummies Questions & Answers

banner character replacement

Can we able to replace the character # in banner command with some other characters. Can we able to blink the character in Kornshell (1 Reply)
Discussion started by: sivakumar.rj
1 Replies

6. Programming

python, character replacement

Hello, I need to do this in python but I'm just learning py and it's quite urgent. I have a script I created and need an interactive python script to modify part of a line. MY SCRIPT #ligand prep. Uses 'ind' prefix. The initial ligand must be ind.pdb. This #generates ind.pdbqt.... (0 Replies)
Discussion started by: gav2251
0 Replies

7. UNIX for Dummies Questions & Answers

global search and replacement of a non-ascii character

Hi, I need to do a global search and replacement of a non-ascii character. Let me first give the background of my problem. Very frequently, I need to copy set of references from different sources. Typically, a reference would like this: Banumathy et al., 2002 G. Banumathy, V. Singh and U.... (1 Reply)
Discussion started by: effjay
1 Replies

8. Shell Programming and Scripting

Deleteing one character after an special character

I have below line in a unix file, I want to delete one character after "Â". 20091020.Non-Agency CMO Daily Trade Recap Â~V Hybrids The result should be : 20091020.Non-Agency CMO Daily Trade Recap  Hybrids i dont want to use "~V" anywhere in the sed command or any other command, just remove... (1 Reply)
Discussion started by: mohsin.quazi
1 Replies

9. Shell Programming and Scripting

sed - replacement file path with variable - Escaping / character

Hi,, I have the line below in a file: $!VarSet |LFDSFN1| = '"E:\APC\Trials\20140705_427_Prototype Trial\Data\T4_20140705_Trial_Cycle_Data_13_T_Norm.txt" "VERSION=100 FILEEXT=\"*.txt\" FILEDESC=\"General Text\" "+""+"TITLE{SEARCH=NONE NAME=\"New Dataset\" LINE=1I want to write a script to change... (2 Replies)
Discussion started by: carlr
2 Replies

10. Shell Programming and Scripting

Trigger email from script if the Special Character replacement is successfull

Hello Gurus, I have a script developed... #!/bin/bash #--------------------------------------------------------------------- # This pScript will remove/replace the special characters fromfiles #--------------------------------------------------------------------- trxdate="`date... (1 Reply)
Discussion started by: nanduedi
1 Replies
XmTabListReplacePositions(library call) 								   XmTabListReplacePositions(library call)

NAME
XmTabListReplacePositions -- A convenience function that creates a new tab list with replacement tabs SYNOPSIS
#include <Xm/Xm.h> XmTabList XmTabListReplacePositions( XmTabList oldlist, Cardinal *position_list, XmTab *tabs, Cardinal tab_count); DESCRIPTION
XmTabListReplacePositions creates a new tab list that contains the contents of oldlist, but with the tabs at the positions in position_list replaced with copies of the corresponding tabs in tabs. A warning message is displayed if a specified position is invalid; for example, if the value is a number greater than the number of tabs in the tab list. This function deallocates the original tab list after extracting the required information. It is the caller's responsibility to free the tabs in tabs by using the XmTabFree function. oldlist Specifies the tab list. The function deallocates the tab list after extracting the required information. position_list Specifies an array of positions of the tabs to be replaced. The position of the first tab is 0 (zero), the position of the second tab is 1, and so on. tabs Specifies an array of the replacement tabs. tab_count Specifies the number of elements in position_list and tabs. RETURN
If tabs, oldlist, or position_list is NULL, or tab_count is 0 (zero), returns oldlist. Otherwise, this function returns the new tab list. The function allocates space to hold the returned tab list. The application is responsible for managing the allocated space. The applica- tion can recover the allocated space by calling XmTabListFree. RELATED
XmTabList(3). XmTabListReplacePositions(library call)
All times are GMT -4. The time now is 06:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy