How to delete ctrl key values in a given string?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to delete ctrl key values in a given string?
# 1  
Old 10-15-2008
How to delete ctrl key values in a given string?

Hi all,

My query is... in the runtime, you are getting any input string. Unfortunately, you have pressed some ctrl keys or esc keys or arrow keys while typing input string. You can get the input value like that...
input string as
welcome^[[DtoB ngalore

So ,I want to remove those unwanted keys value...like that
Welcome to Bangalore

could you suggest me guys which unix commands I can use?

Thanx
BalanSmilie
# 2  
Old 10-15-2008
remove everything except the alphabets

Code:
echo $input_string | sed 's/[^a-zA-Z]//g'

# 3  
Old 10-15-2008
Hi,

echo $input_string | sed 's/[^a-zA-Z]//g'
if I use abu cmd... can get the following output only.

Welcome Dto BangaloreBABDDCCC

this removes only ^ [ ]  that chars.

i need exact string like Welcome to Bangalore

I tried already that cmd....thats y i confused

please clear my query yaar!
# 4  
Old 10-15-2008
How to delete ctrl key values in a given string?

I thing, we have to find out key values. we can delete those key values if we found.

But how can we find those key valuesSmilie
# 5  
Old 10-16-2008
Plz, anybody help me!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How do delete certain lines alone which are matching with start and end string values in file?

Hi, In my previous post ( How to print lines from a files with specific start and end patterns and pick only the last lines? ), i have got a help to get the last select statement from a file, now i need to remove/exclude the output from main file: Input File format: SELECT ABCD, DEFGH,... (2 Replies)
Discussion started by: nani2019
2 Replies

2. Shell Programming and Scripting

How to delete a columns of a CSV file which has cell values with a string enclosed in " , "?

Hi How can I delete a columns from a CSV file which has comma separated value with a string enclosed in double quotes or square bracket and a comma in between? I have a csv file with below format. Template,Target Server,Target Component,Rule Group,Rule,Rule Reference Number,Rule... (7 Replies)
Discussion started by: Litu19
7 Replies

3. Shell Programming and Scripting

How to delete a column/columns of a CSV file which has cell values with a string enclosed in " , "?

How can I delete a column from a CSV file which has comma separated value with a string enclosed in double quotes and a comma in between? I have a file 44.csv with 4 lines including the header like the below format: column1, column2, column3, column 4, column5, column6 12,455,"string with... (6 Replies)
Discussion started by: dhruuv369
6 Replies

4. UNIX for Dummies Questions & Answers

Ctrl-V + Ctrl-J for newline character does not work inside vi editor

Hi friends, I am trying to add a newline char ('\n') between the query and the commit statement in the following shell script. #! /bin/sh echo "select * from tab; commit;" > data.sql I have tried typing in "Ctrl-V + Ctrl-J" combination which has inserted ^@ (NUL) character but the commit... (1 Reply)
Discussion started by: royalibrahim
1 Replies

5. Shell Programming and Scripting

sh: Detect key (CTRL/SHIFT/CAPS LOCK) state?

I'm trying to write a shell script that runs periodically and if I'm not at the keyboard, it should do one thing, but if I am at the keyboard, it should do another thing. Therefore I've decided that it would be good if I could press down the CTRL key, (or some other key) and have the shell script... (8 Replies)
Discussion started by: Ilja
8 Replies

6. Shell Programming and Scripting

Write a shell script to find ctrl M and delete them

Hi All, I would like to write a shell script to find Control M charactes and after getting the result i want to delete it. But in the script the following command couldn't work. find . -exec grep -l '^M' {} \; > test.txt ^M is ctrl V and M thanks in advance for any help. (4 Replies)
Discussion started by: jatanig
4 Replies

7. Shell Programming and Scripting

How to pick values from column based on key values by usin AWK

Dear Guyz:) I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z). I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Discussion started by: repinementer
16 Replies

8. Shell Programming and Scripting

How to issue ctrl+D and enter key

My problem is that i have to connect Linux server. I can connect it with SSH but because of the software of the Linux server, i need to press enter and after ctrl+D. Therefore, I need to write a script that should press enter and ctrl+D. How can i write it in KSH shell script. HELP ME! (7 Replies)
Discussion started by: fozay
7 Replies

9. Shell Programming and Scripting

Disabling ctrl-Z key inside shell script

Hi I have tried to disable the CTRL-Z key inside a shell(sh) script using the command trap "`echo "Ctrl-Z key disabled"`" 20But I am not able to exit from the script after pressing CTRL-Z key. How to proceed this? Need reply soon (11 Replies)
Discussion started by: suganthic
11 Replies

10. AIX

Disable ctrl-c,ctrl-d,ctrl-d in ksh script

I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
Discussion started by: wtofu
6 Replies
Login or Register to Ask a Question