Tab and Enter


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Tab and Enter
# 8  
Old 01-17-2011
\ as the last character of the line removes the linefeed character that immediately follows (if it is interpreted by the shell (and some programs))

So:
Code:
plot 'datafile1' , \
'datafile2'

is the same as:
Code:
plot 'datafile1' , 'datafile2'

---------- Post updated at 10:22 ---------- Previous update was at 10:04 ----------

In your last example you use \ before a space instead of a linefeed, BTW. If it is used to remove a linefeed then it needs to be the last character on the line before the linefeed..
# 9  
Old 01-17-2011
Yeah I totally agree. But that was not my purpose. I want to put datafile name at every line, as you can see that I am changing the name through the for-loop. At the same time I want to keep them as parts of instruction so that I can finally use in gnuplot.

In other word, can you modify the script so that it works? Like

echo "p x**2, x**3, x**4"|gnuplot -persist But here I wish to plot for other powers in general, e.g. it can be extended to x**5, x**6, etc., which will be decided by the for-loop.

Thanks.
# 10  
Old 01-17-2011
To produce a backslash with echo you need to escape it with another backslash:
Code:
echo "something something else \\"

# 11  
Old 01-17-2011
Great !! Smilie

It worked ! Thanks, Scrutinizer.

So I feel that the " \" is not understood as a command in echo unless we use another "\" alongwith. Since if I don't remove the 'temp' file (as used in my script file), then "cat temp" gives

plot \
x**2, \
x**3, \
x**4

So one one slash has been used as an identifier of the other slash as a command.

Another important thing I required to do is to remove the extra space before the last quote, i.e.

\ "

should be replaced by

\\"

Hope this would help others who come across the same problem.

So it also belongs to the plotting in gnuplot using shell script
category.
# 12  
Old 01-17-2011
Quote:
Originally Posted by hbar
Great !! Smilie

It worked ! Thanks, Scrutinizer.
You're welcome Smilie
Quote:
So I feel that the " \" is not understood as a command in echo unless we use another "\" alongwith [..]
\ is understood as a special character if used inside double quotes.. If you precede it with another backslash, it is taken literally, so the character "\" gets printed. This character is then given a special meaning by GNU plot since it is the last character before the linefeed and thus it indicates a continuation of the line..
# 13  
Old 01-17-2011
Yes, you are right. Thanks. Smilie
 
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