Visit Our UNIX and Linux User Community


Suppress tabs in csh here document?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Suppress tabs in csh here document?
# 1  
Old 09-29-2009
Suppress tabs in csh here document?

Hi all, I have seen in other shells you can suppress tabs in a here document with formatting such as:

Code:
vi $somefile <<-heredocument
                 some tab indented code for readability
heredocument

with a - before the here document declaration, but this doesn't work in csh, can someone confirm if this is possible or not in this shell?

Thanks in advance
# 2  
Old 09-29-2009
are looking for the commands like..
tab,unexpand,tr etc etc...
# 3  
Old 09-29-2009
Thanks for the pointers, tr looks like it could do the trick, however I am unsure how to implement it in the case of a here document, could you give me a syntax example?

---------- Post updated at 10:45 AM ---------- Previous update was at 05:34 AM ----------

So, piping from a command to tr works as follows

Code:
cat testfile | tr -d '\011'

Here tabs are removed from the contents of file testfile as it's printed in the terminal, however this command doesn't work for a here document, either trailing the here document declaration, or after each of the commands within the here document. This must be because tr is removing tabs in the data resulting from executing that line of code rather than removing the tabs on the line of code itself before execution.

Unless anyone can correct me, I will have to assume suppressing tabs in a csh here document is just not possible...
# 4  
Old 09-29-2009
It seems you're right <<- doesn't work in CSH.

But you can use:

Code:
#!/bin/csh
tr -d '\t' << EOF | vi -
        Hi there!
EOF


Previous Thread | Next Thread
Test Your Knowledge in Computers #993
Difficulty: Medium
Illumination is a free and open-source Unix operating system based on OpenSolaris.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Suppress do you wish to overwrite (y or n)?

Hi all, as i have to deal every day with .log and also .csv files, i would like to know if there is any way to suppress "do you wish to overwrite (y or n)?" prompt with the option no for all prompts, the command i usually run is the following, find... (2 Replies)
Discussion started by: charli1
2 Replies

2. Shell Programming and Scripting

How to suppress error in following command?

I have a file containing data in multiple columns. The colums are seperated by pipe (|). I need to extract information as below: myfile_20130929_781;10;100.00 where myfile.txt is the file name. 10 is the number of records in the file starting with 120 and 100.00 is the sum of 26th field of... (16 Replies)
Discussion started by: angshuman
16 Replies

3. Shell Programming and Scripting

Suppress Error Message

How can I suppress a error message being given by awk command in bash shell? (2 Replies)
Discussion started by: Prachi Gupta
2 Replies

4. UNIX for Dummies Questions & Answers

Tool to suppress lines where value=0

Hello everyone, Here's the problem, I have a list generated by this command; watch -n 5 'iptables -nvL | grep "DROP"' It generates output that looks like this (severely truncated for clarity) Every 5.0s: iptables -nvL | grep "DROP" ... (2 Replies)
Discussion started by: putter1900
2 Replies

5. Shell Programming and Scripting

Here document inside a here document?

Can we use a here document inside a here document? Something like this ssh user@remotehost << REMOTE sudo vserver vsernamename enter << VSERVER perform actions on vserver. VSERVER REMOTE (6 Replies)
Discussion started by: mnanavati
6 Replies

6. Shell Programming and Scripting

how to suppress dd output?

I have to stop the output of dd from writing to terminal. Here is the command: sudo dd if=boot1h of="/dev/r$temp1" Here is the output: 2+0 records in 2+0 records out 1024 bytes transferred in 0.000804 secs (1273715 bytes/sec) I have tried >> log.txt but it doesn't work. Is there... (4 Replies)
Discussion started by: msf5042
4 Replies

7. Shell Programming and Scripting

suppress unzip queries

hey i have piece of code working in solaris and same code i want to deploy it in linux but in solaris its not asking for queris but in linux it is !!!! COMMAND ==> unzip $test/alter.war -d $webclientHome/. OUTPUT==> In solaris it proceeds with following traces replace /aa/test.txt?... (4 Replies)
Discussion started by: crackthehit007
4 Replies

8. Shell Programming and Scripting

Suppress awk warnings

Hello everyone, Sorry if this is a bit of an RTM thing, but I can't find any flags for suppressing warnings with awk and Googling (this site too) didn't yield much useful. Does anyone know how to suppress warnings? The warning I'm specifically trying to remove is one warning me that I'm... (1 Reply)
Discussion started by: kdelok
1 Replies

9. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

Featured Tech Videos