Displays the text upward


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Displays the text upward
# 1  
Old 10-21-2011
Displays the text upward

I need to print out text from a file in the console up, you know someone like that?
# 2  
Old 10-21-2011
'Someone' like who?
Could you elaborate what you're after (hopefully with examples)?
# 3  
Old 10-21-2011
as in, make the console go backwards?

This can vary depending on your terminal since it's not a standard feature, but the escape sequence "ESC M" moves the terminal up one line in at least some.

Try this. It reads lines from /etc/passwd ( you can use anything you want ), adds two ESC-M sequences, then prints the lines one by one. Scrolls up handily on this system.

Code:
sed 's/$/\x1bM\x1bM/' < /etc/passwd | while IFS="" read LINE
do
        sleep 1
        echo "$LINE"
done

This User Gave Thanks to Corona688 For This Post:
# 4  
Old 10-21-2011
I need to print out text from a file in the console up

Last edited by gizmo16; 10-23-2011 at 02:46 AM..
# 5  
Old 10-21-2011
Is this homework?
# 6  
Old 10-21-2011
yes...I need to print out text from a file in the console up
# 7  
Old 10-21-2011
Post in the homework forum, following the homework rules please.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script Output Displays Multiple Text

Hello there, I'm using a read-while loop to preserve the word Failed within a text file. For example, if the word Failed exist twice in a single text file, my STDOUT should re-direct to a new text file and display Failed twice. My output is attached to this thread. I would like output to... (4 Replies)
Discussion started by: SysAdminRialto
4 Replies

2. Shell Programming and Scripting

Bash $(...) DISPLAYS EVERY COMMAND

I use things like this a lot in ksh and bash, but lately bash has been printing the command for every loop: ... | while read f do if then echo Differ "$f" fi done How to prevent this? (5 Replies)
Discussion started by: DGPickett
5 Replies

3. Shell Programming and Scripting

Script going upward and downward direction

Hello, I have a log file as shown below. Each line starts with instance nr. : Session: IP Processing HTTP Socket Command : Connecting User-Agent Media: : NOT Rejected Media : Session: Username Request Channel : Username : Check if he is in User Database : Username : not in the... (6 Replies)
Discussion started by: baris35
6 Replies

4. UNIX Desktop Questions & Answers

Cat/tac displays nothing but vi does

Hi, Today i have seen a file which shows nothing when i use cat/tac. But when i use vi it displays a single line at the top. There are no other lines. I am curious why cat/tac doesn't display that line and only vi does? Any thoughts? Thanks in advance, (1 Reply)
Discussion started by: pandeesh
1 Replies

5. Solaris

ls -l displays output with an error

when i use ls command it works normal but when i using additional parameter with ls like ls -l , ls -a... it shows a error followed by the output. # ls -l ./hgfs: Operation not applicable total 12861 -rw-r--r-- 1 root root 0 Jun 1 21:12 1 drwxr-xr-x 2 root root ... (4 Replies)
Discussion started by: chidori
4 Replies

6. UNIX for Dummies Questions & Answers

ls -l displays size in KB, MB, GB?

Hi, ls -l displays the long listing of a file in 8 fields. Query: ------ Does ls -l display the filename size in KB or MB or GB? -rwxrwxr-x 1 xx dba 655 May 22 06:27 time Here 655 is KB or MB or GB? Many thanks. (2 Replies)
Discussion started by: venkatesht
2 Replies

7. Solaris

swap displays differently

A new x86 server was installed with 16G of memory. The swap space assigned in the prtvtoc is also 16G. But after the installation of the OS and verifying, noticed df -k output for swap shows as 30G. Other systems do not have this characteristic. Whats wrong in here?:eek: (4 Replies)
Discussion started by: incredible
4 Replies

8. AIX

who -r displays no output

Hello. I have an AIX machine at 6100-00. We had some strange activity since filling up /tmp. One symptom is that who -r displays no output. It doesn't hang just no output is displayed. We are going to boot the machine, but prior to that I'd like to dig a bit to see what may be causing the... (0 Replies)
Discussion started by: maficdan
0 Replies

9. HP-UX

Dual Displays HP-UX 10.20

Hello All! Where I work we have C3600's that have a video cards that have both DVI and Regular RBG type monitor ports on them. My question is: is it possible to spread my desktop across two monitors that are plugged into the one card much like you can do with NVIDIA software like NVIEW for... (0 Replies)
Discussion started by: giftedone
0 Replies

10. UNIX for Dummies Questions & Answers

Dual Displays

I have a TV and a monitor hooked up to my box. Right now the system is displaying all the information on the TV instead of the monitor, obviously I want to switch this, as the TV is very impracticle for everything other than watching movies. I thought I remembered a command I used to use that... (2 Replies)
Discussion started by: Synbios
2 Replies
Login or Register to Ask a Question