String operation in csh shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting String operation in csh shell
# 8  
Old 02-22-2017
It's the geek version of {print}.
In fact it gives a non-zero =true value in an implicit if where the default action is {print}.
This User Gave Thanks to MadeInGermany For This Post:
# 9  
Old 02-22-2017
A code block followed by an expression like that, prints the line whenever the expression is true. As an expression, 1 is always true.

The code block is actually optional. Just awk '1' filename will print every line... awk '/string/' filename will match every line matching "string" (where the regex evaluates true), etc. It's a useful on-off switch for printing.

Last edited by Corona688; 02-22-2017 at 10:46 AM..
This User Gave Thanks to Corona688 For This Post:
# 10  
Old 02-22-2017
Note that since an assignment returns the value assigned and since the value being assigned is not an empty string and is not zero, the script can be written as just a condition with the default action simplifying the script to just:
Code:
awk -F';' '$2=5' OFS=';' inputfile > outputfile

This User Gave Thanks to Don Cragun For This Post:
# 11  
Old 02-23-2017
Thanks a lot to everybody
for your fast Response and a Explanation for my question
With Kind regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String operation in csh AIX 4.3.2.0

Hi to everybody i stuck on a simple thing i had a string and i want cut it , i try already few thing with the cut command but does not the way it should. The script is in csh and running on AIX 4.3.2.0 here are few samples how the string can look like FT71;1;1;1;;;1;31.01.2017... (9 Replies)
Discussion started by: Nadielosabra
9 Replies

2. Shell Programming and Scripting

Pass C shell array to another C shell script(csh) and shell(sh)

Dear Friends, Please help me on this my script name is send.csh In this i have written the statement like this set args = ( city state country price ) I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell or how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies

3. Shell Programming and Scripting

Complex string operation (awk, sed, other?)

I have a file that contains RewriteRules for 200 countries (2 examples for 1 country below): RewriteRule ^/at(/|/index.html|)$ http://%{HTTP_HOST}/locate/index.html?locale=de_AT #& RewriteRule ^/at_english(/|/index.html|)$ http://%{HTTP_HOST}/locate/index.html?locale=en_AT I have... (5 Replies)
Discussion started by: usshadowop
5 Replies

4. Shell Programming and Scripting

String processing in CSH

Please delete it (0 Replies)
Discussion started by: animesharma
0 Replies

5. Shell Programming and Scripting

String Operation

/home8/mc09ats/UnixCw/file4 this is the path...i have 2 variables filename and filepath...i want filename=file4 filepath=/home8/mc09ats/UnixCw i.e. i think i have to find last occurence of "/" in string and the string after "/" want to take in some variable and string before last "/"... (4 Replies)
Discussion started by: AbhijitIT
4 Replies

6. Shell Programming and Scripting

Help - Search for string, then do string operation on line

Hi, I wish to find all lines that contain a specific search word, and then do few string operations on that line. The idea is to "fix" the file which has been moved from windows to unix. Using unix - Sun Solaris Test input ("t2.sas") statement1 statement2 libname yahoo ... (6 Replies)
Discussion started by: deepaksinbox
6 Replies

7. UNIX for Dummies Questions & Answers

string operation

I am trying to ask for full name in a script, Then echo back to the user with the surname only, omitting the first name. Thanks (2 Replies)
Discussion started by: orjnet
2 Replies

8. Shell Programming and Scripting

string operation

i am new user of unix.i have a question.My script is- export STR_ALFA=`head -2 "${FILE_PATH}"|tail -1|cut -d"," -f1` "${TEST_HOME}"/function/chk_alfa.ksh STR_ALFA now i want to check STR_ALFA: 1)whether is alphabetic 2)whether is numeric 3)whether is alphanumeric... (1 Reply)
Discussion started by: arghya_owen
1 Replies

9. Shell Programming and Scripting

string operation

i am new user of unix.i have a question.My script is- export STR_ALFA=`head -2 "${FILE_PATH}"|tail -1|cut -d"," -f1` "${TEST_HOME}"/function/chk_alfa.ksh STR_ALFA now i want to check STR_ALFA: 1)whether is alphabetic 2)whether is numeric 3)whether is alphanumeric... (1 Reply)
Discussion started by: arghya_owen
1 Replies

10. Shell Programming and Scripting

string operation

Hi all, Here is my situation. I have a text file TXT_FILE like this: john 123456 jack 94589 kelvin 94595 mary 88585 I want to read the first word in each line ( the name ) and assign to a string variable ( EX_LIST ) in my script so that I can use later as this commandfor i in... (6 Replies)
Discussion started by: fongthai
6 Replies
Login or Register to Ask a Question