PDA

View Full Version : Freeze a Line on a shell script



Mbengi Bongi
April 21st, 2009, 11:44 PM
Is there a way of "freezing" a line of text in a shell script, i.e. like on a spreadsheet?

I though perhaps it may be echo with a switch but I checked the man page and there doesn't seem to be anything relevant.

Basically I want to write a script that parses and extracts data from a csv file line by line but the first line is my headings and I want that to be visible all the time rather than it disappearing off the screen.

Can anyone help? ;)

tgalati4
April 22nd, 2009, 12:47 AM
Zenity could pop up a dialog box with the header info.

man zenity

ghostdog74
April 22nd, 2009, 01:12 AM
are you parsing line automatically? or are you parsing the file, viewing each line as it goes? show some sample input and describe the output you want.

Arndt
April 22nd, 2009, 08:49 AM
Is there a way of "freezing" a line of text in a shell script, i.e. like on a spreadsheet?

I though perhaps it may be echo with a switch but I checked the man page and there doesn't seem to be anything relevant.

Basically I want to write a script that parses and extracts data from a csv file line by line but the first line is my headings and I want that to be visible all the time rather than it disappearing off the screen.

Can anyone help? ;)

If you know that the terminal or terminal emulator is ANSI-compatible (gnome-terminal, xterm, etc. are), you can use a control sequence to set the scroll region. See http://www.shaels.net/index.php/propterm/7-documents/16-scroll-control.

For example, try:


echo -e "\e[6;24r"

Mbengi Bongi
April 22nd, 2009, 09:38 PM
If you know that the terminal or terminal emulator is ANSI-compatible (gnome-terminal, xterm, etc. are), you can use a control sequence to set the scroll region. See http://www.shaels.net/index.php/propterm/7-documents/16-scroll-control.

For example, try:


echo -e "\e[6;24r"

That's perfect Arndt, that's exactly what I needed!!!

Thanks very much :popcorn:

Arndt
April 22nd, 2009, 10:03 PM
That's perfect Arndt, that's exactly what I needed!!!

Thanks very much :popcorn:

I last used that feature of terminals 26 years ago, believe it or not; nice that some standards stay worth knowing.