Strip all non-alphanumerics


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Strip all non-alphanumerics
# 1  
Old 09-17-2006
Strip all non-alphanumerics

Hi,
Can someone let me know how do I strip out any non-alphanumeric character in string tomake it alphanumeric?

i.e
abc def ghi ->abcdefghi
abc-def-ghi ->abcdefghi
abc#def-ghi->abcdefghi


Thanks in advance

Last edited by rbatte1; 06-27-2016 at 05:46 AM..
# 2  
Old 09-17-2006
Code:
echo 'abc#def-ghi' | sed 's/[^a-zA-Z0-9]//g'

# 3  
Old 09-17-2006
Thanks a lot !!
# 4  
Old 09-17-2006
tr also

Code:
echo 'abc#def-ghi' | tr -cd [:alnum:]

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep and alphanumerics

Hi Experts, I'm facing an issue with grep or may be Im missing something. Following are the details Input file # more regexp asdh1987 dog897you 981towm 1234oqn 4yuop8pou sam99917c00l Akoold0g8 data sample data Im trying to grep out only the alphanumeric entries and following... (10 Replies)
Discussion started by: maverick_here
10 Replies

2. Shell Programming and Scripting

Strip First few Characters

I want to strip first few characters from each record until a proper datesamp is found. Request for getNextPage.................06/29/12 07:49:30 VVUKOVIC@67.208.166.131{7A805FEF76A62FCBB23EA78B5380EF95.tomcat1}TP-Processor14 LogExchUsage: ERROR:: isprof=false : exch=NSDQ output should be... (2 Replies)
Discussion started by: ratheeshjulk
2 Replies

3. Solaris

strip error

Hi I am getting the below error while using strip command. strip: libelf error. Request error: no string table strip: a.out: file not manipulated Could somebody please let me know what might be the solution?? It is in ksh and solaris 10. Thanks in advance (4 Replies)
Discussion started by: vali__
4 Replies

4. Shell Programming and Scripting

How to filter Alphanumerics

Hi all, Can you please let me know how to achieve the below thing AAABBCC@#$W123 123@#$DFG<>. Output: AAABBCW123 123DFG i.e I want to filer only alphanumerics from the strings (4 Replies)
Discussion started by: marcus_kosaman
4 Replies

5. Shell Programming and Scripting

Strip out the string

awk -F"\t" -vOFS="\t" '{print $1"\t-\t-","",$6,$7"\t-"$8"\t-\t-\t"$15}' file.tsv > output.tsv Using the above command how to remove the string www.abc.com from the $7 value. (7 Replies)
Discussion started by: sandy1028
7 Replies

6. Shell Programming and Scripting

Need to strip few letters

Hey guys.. Can experts help me in achieving my purpose.. I have a file which contains email address of some 100 to 1000 domains, I need only the domain names.. Eg: abc@yahoo.com hd@gamil.com ed@hotmail.com The output should contain only Yahoo.com ... (5 Replies)
Discussion started by: achararun
5 Replies

7. Shell Programming and Scripting

Need to strip a string

I have a file that looks like this: /home/fred/opt/bin /opt/usr/bin /usr/sbin/var/opt I need a way to chop of everything after the last occurance of the / sign including the /. So the file above will now look like this below. /home/fred/opt /opt/usr /usr/sbin/var I tried using... (6 Replies)
Discussion started by: x96riley3
6 Replies

8. Shell Programming and Scripting

How to strip strins

Guys, Please can someone tell me how to strip each string from the following ? TABLE1||METHOD||TYPE||STATUS||DATE What i need is to assign each value to the variable TABLE1 to var1 METHOD to var2 and so on If there is NULL in one of them, something like A||B||||C|| I want the... (14 Replies)
Discussion started by: kamathg
14 Replies

9. UNIX for Dummies Questions & Answers

Use non alphanumerics in join

Hi, I have a problem while joining two sorted files with "join". File 1.txt Alnus|123 ALO140102|234 ALO 1401 02|345 ALO-1401-02|456 Alobar Holoprosencephalies|567 File 2.txt 1|Alnus| 1|ALO 1401 02| 1|ALO-1401-02| 1|Alobar Holoprosencephalies| If I join the files as follows:... (1 Reply)
Discussion started by: s0460205
1 Replies
Login or Register to Ask a Question