Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use Delete Key as keystroke in script text? 3

Status
Not open for further replies.

ElaineCairns

Programmer
Apr 24, 2003
2
US
I am creating a text file that will be updating a lot of records. I would like to use the Delete key to remove the characters in a certain field.

Is this possible?
 
Elaine, can you expand a little on the process involved, please, perhaps giving a dummy sample of the text file you're working on. Cheers.
 
Hi,
do you mean you want to use something like SED and delete the last character of the line so you want to put the DELETE KEY into your script to have it executed?

Something like <CNTL-V><DEL> or \777



 
My reply usually is floppy, but my thoughts are combining awk and sed to locate where you want to delete, or substitute the field with nothing, that is delete.
 
I will be using cobrun < input_file to update records.
Here is what the text file looks like in vi:
A01234
XXX

1
12
Y
A01235
XXX

1
12
Y


I want to use the Delete Key for the XXX. Previously, I was using spaces to delete the characters but run into problems when using our query tool.

Where do I find the ascii characters of the Delete Key?

Thanks for the assistance!


 
Still not sure about your question. Are you writing script, query, use VI editing files or try to change environment setting???

if script -->
suppose x is your text input file, the following command would produce a new file xx that would get ride of XXX
sed 's/XXX//g' x | sed '/^$/d' > xx

if query -->
I do not know what kind of query tool you are using, or not know cobrun

if VI editor,
letter 'x' is for delete a single position

if environment,
check out comman 'xmodmap', i.e. type man xmodmap

hope it helps but feel free to reply if not
 
Can the &quot;tr&quot; command delete single letters or just all of the letters that match it? Like below...

UserID FullName Paid Type Credit
030202024 Smith, Ryan N. N R 3.00

Any help is appreciated. I tried this tr '[N]' ' ' and tr '[R]' ' ' but nada. I'm needing to get rid of just the letter N under the Paid column.

Thanks,

Ace
 
In this special case, you could use any substitute function (awk, sed, tr, vi etc.) to replace &quot; N &quot; with a single space. Notice the spaces before and after N.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top