Solved

Unix General question

Posted on 1997-09-23
8
195 Views
Last Modified: 2013-12-27
As I know , by using escape sequence control, we can
creat special effect Assic art, like moving text. But
here in my university sun solaris terminal, I don't how
to edit a file contains control sequence. Using pico, it
doesn't repond when I press ESC key. What should I do?
Thanks.

0
Comment
Question by:xz02
8 Comments
 
LVL 1

Expert Comment

by:szetoa
Comment Utility
I may have a solution if you know how to use 'vi'.  First you need to 'insert' an ESC character in a file.  Then you just keep copying this character whenever you need to create another control sequence.  At your UNIX prompt, try this:

echo <ESC> > afile

NOTE:  <ESC> is the escape key, the second '>' is the output redirection, and afile is any file name you want.  This command inserts a single character in the 'afile' and then you can use 'vi' to add other characters after the <ESC>.

p.s.  I believe the <ESC> character looks like ^[, but actually it is only one character.  You can also use 'yank' and 'paste' commands in 'vi' to duplicate this character.
0
 

Author Comment

by:xz02
Comment Utility
Thank you,szetoa,your answer is perfect.
How do give you points?
0
 
LVL 1

Expert Comment

by:szetoa
Comment Utility
xz02,

Glad it helps.  But this is my first time to response to any question and I have no idea how to get points.  Keep the points. You may need them for other questions.
0
 
LVL 3

Expert Comment

by:gwalters
Comment Utility
To get points, you have to "answer", not "comment".
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 4

Expert Comment

by:jos010697
Comment Utility
There's no need to copy those escape characters. Vi has the
^v (control-V) prefix. If you want to insert an escape somewhere
in your text, simply press i ^v <escape>, i.e. 'i' for insert,
^v for 'literal character' and <escape> for escape ...

kind regards,

Jos aka jos@and.nl
0
 
LVL 1

Expert Comment

by:szetoa
Comment Utility
xz02,

Give the points to 'jos'.  S/he got a better answer.
0
 
LVL 4

Expert Comment

by:jos010697
Comment Utility
Who cares about those points (points don't buy you anything ;-)
as long as it helps out 'xz02', everything is fine, isn't it?

kind regards,

Jos aka jos@and.nl

ps. BTW, I'm male ;-)

0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 40 total points
Comment Utility
! echo <ESC> > afile
! NOTE: <ESC> is the escape key, the second '>' is the output redirection, and

szetoa, this doing at a "UNIX prompt" (what do you mean by that?)
will do nothing, in most cases, means you get a file just containing a \n (newline). Ups, you also may hear a beep.
If this will work depends on a lot of thing:
  1. the flaviour of UNIX
  2. the shell (sh, csh, bash, zsh, ash, etc. etc.)
  3. $PATH in this shell, and therefore if it is the shell's builtin echo or an external command found via $PATH

As jos said, you may get these chars by using vi's ^v facility.
But take care using vi with files which have non-visibale chars, use the  `set list'  command in vi to see them all (man vi, you know .. ;-).

And for those who care about the points, I marked it as answer so that it might get off the list of questions :-))
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now