Tab and Enter


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Tab and Enter
# 1  
Old 01-15-2011
Tab and Enter

Do Tab or Enter behave like a command in some cases? For example,
I had been trying to plot with gnuplot by usinf shell script like command inside:

cat plot.gnu gives :
plot 'datafile1' , \
'datafile2'

Now gnuplot doesn't recognize the newline command "\"
unless I use "enter" in the vi-editor.
i.e. gnuplot -persist plot.gnu doesn't work

Similarly I found that commands are not recognized in Makefile if I don't specifically use "tab" space inside the vi-editor.
(I could have made a tab-space by using 'echo' in a shell script file, but that doesn't work!)

Thank you in advance.

Last edited by DukeNuke2; 01-15-2011 at 06:12 AM..
# 2  
Old 01-15-2011
Quote:
Originally Posted by hbar
Now gnuplot doesn't recognize the newline command "\"
"\" isn't a newline but something that commonly escape the next character, precisely a newline in your example.
Quote:
Similarly I found that commands are not recognized in Makefile if I don't specifically use "tab" space inside the vi-editor.
That's by design, a tab must precede commands in the Makefile syntax.
Quote:
I could have made a tab-space by using 'echo' in a shell script file, but that doesn't work!
Just use instead:
Code:
printf "\t"

# 3  
Old 01-15-2011
Dear Jiliagre,

Thanks for the reply. I'll try this for tab. But what about the making newline instruction? What could be the way to resolve the problem in my first example?
# 4  
Old 01-16-2011
Please explain better the problem you have with your first example with error messages if any. Newline is anyway unlikely an instruction per itself but probably a command separator.
# 5  
Old 01-17-2011
Thanks. Let me try once again. My example may be specific to gnuplot. But it may arise to other cases.

If run the follwing commands :
Code:
#!/bin/bash
echo "plot  \ " > temp
for f in 2 3
do
echo "x**"$f", \ " >> temp
done
echo "x**4" >> temp
cat temp | gnuplot -persist
rm -f temp

=======

I find the following error messages :
Code:
gnuplot> plot  \ 
               ^
         line 0: invalid character \


gnuplot> x**2, \ 
               ^
         line 0: invalid character \


gnuplot> x**3, \ 
               ^
         line 0: invalid character \


gnuplot> x**4
         ^
         line 0: invalid command

====================

Whereas
Code:
echo "p x**2, x**3, x**4"|gnuplot -persist

works successfully though it's the same in principle.


Hope I could clarify this time. My observation is that the newline separator (" \") is not recognized by the shell always.

I have attached the shell script as well. You may need to install gnuplot in case it's not installed by your distribution.

Thanks and best regards.

Last edited by Franklin52; 01-17-2011 at 04:49 AM.. Reason: Please use code tags
# 6  
Old 01-17-2011
Quote:
Originally Posted by jlliagre
"\" isn't a newline but something that commonly escape the next character, precisely a newline in your example.
\ at the end of the line is the only case where \ does not work as an escape character. Rather, it removes the linefeed character that follows altogether..

Last edited by Scrutinizer; 01-17-2011 at 04:51 AM..
# 7  
Old 01-17-2011
@Scrutinizer

Sorry, did you mean " \" skips all the lines after it or the next line only?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Replace a column in tab delimited file with column in other tab delimited file,based on match

Hello Everyone.. I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files FileP.txt ... (2 Replies)
Discussion started by: YogeshG
2 Replies

2. Shell Programming and Scripting

Loop logic, enter into respective IF as per enter input file name

have three big data file, however I just need to see the mentioned below one line form the all the file which has SERVER_CONNECTION Value File 1 export SERVER_CONNECTION=//dvlna002:10001/SmartServer File2 export SERVER_CONNECTION=///SmartServer File3 export... (1 Reply)
Discussion started by: Nsharma3006
1 Replies

3. UNIX for Dummies Questions & Answers

tab delimited file that is not tab delimited.

Hi Forum I have a tab delimited file that opens well in Openoffice calc (excel). But when I perform any operation in command line, it reads the file incorrectly. When I 'save As' the same file in office as tab delimited then it works fine. The file that I think is tab delimited is actually... (8 Replies)
Discussion started by: imlearning
8 Replies

4. Shell Programming and Scripting

remove enter

Hi All, I have a file , delimited by | Last column of the file has a extra enter causing error in my program Eg: firstworld <enter>; NO EMP i want data to be firstworld; NO EMP Is there a way to remove enter from a file (2 Replies)
Discussion started by: gwrm
2 Replies

5. Shell Programming and Scripting

Trigger Enter

Hello, I need to trigger every time enter has been clicked while some one on terminal i tried to googleit but with out result any idea ?? thanks in advance (3 Replies)
Discussion started by: AYAK
3 Replies

6. Shell Programming and Scripting

how to have ENTER after each symbol.

I want to know script for Input file : 123456789 outputfile : 1 2 3 4 5 6 7 8 9 now please how can generalize it like i want output : 123 456 789 (5 Replies)
Discussion started by: sparkriver
5 Replies

7. Solaris

Enter to OBP

Hello, today i'm comment in /etc/vfstab fs /usr and my server load in SingleUser without anything commands :( How i can enter to OBP from # ? or ILOM ? I'm try CTRL+BREAK (F5) , CTRL+ALT+BREAK (F5) and #. but it's don't help me :(((( (5 Replies)
Discussion started by: jess_t03
5 Replies

8. Solaris

Cant enter password

When i come to the login screen i will put root and no password, and it will say its incorrect, but even when i try to enter a password nothing comes up in the box (2 Replies)
Discussion started by: possuman72
2 Replies

9. Shell Programming and Scripting

HELP with Enter Character

I'm using PHP in my site. I have txt files for news. I reads the txt files and post the news. i have a php function that finds the caracter asc(13) which is the enter, and puts a <br>. It works in Windows, but not on Unix. Can u help me with that. Thanks (1 Reply)
Discussion started by: zecarlos
1 Replies
Login or Register to Ask a Question