Issue with looping
Hi guys, I am creating a script that checks if a service is UP and running on a bunch of remote servers. My list of servers is: Code: p2 runtime1 8080 p3 runtime2 8080 p4 runtime3 8080 p5 runtime4 8080...
View ArticleReplacing all but the first and last double quote in a line with a single...
From: Code: 1,2,3,4,5,This is a test 6,7,8,9,0,"This, is a test" 1,9,2,8,3,"This is a ""test""" 4,7,3,1,8,"""" To: Code: 1,2,3,4,5,This is a test 6,7,8,9,0,"This; is a test" 1,9,2,8,3,"This is a...
View ArticleMap new file to old file
Hellos, Some columns of a file have undergone name changes from old to new format, to run some of the scripts I need to revert back and rearrange these columns from the new to the old format. oldfile...
View Article\r getting lost in awk
I have a DOS .csv file (EOL=\r\n) that also contains some \n characters representing a new line within in some multi-line fields. I want to change the \r\n sequences to \n (like dos2unix does) but...
View ArticleQuestion on r-queue from vmstat out
On our prod system we found sometime runqueue goes back to 0 as below. Whereas on test server even with very very less work the r-queue never dropped to 0. Under what conditions r-queue drops to 0?...
View ArticleSemaphore - lockfile/flock
Hi, I have a process which can run one instance at a time. Currently we have multiple scripts trying to kickoff this process. I wanted to implement the semaphore mechanism to achieve this. I was going...
View ArticleSyntax error from cshrc, but not showing line number
Hi, I have been using ksh till now but was forced to use tcsh from last few days. I am getting a gvimrc error which says "set: Syntax error". What makes this pesky is that it is not showing which line...
View ArticleUnzip - percentage of uncompression
Hi Experts, Recently i have faced couple of issues in uncompressing a file. File is is not getting uncompressed fully.i.e. E.g. say if the file has 1000 lines , it uncompresses 100 lines and finishes...
View ArticleSpecial IF construct syntax in UNIX
Hi, I don't understand && and || in this context. I thought && is for logical 'AND' and || is for logical 'OR'. Code: [ ! -z "$var" ] && echo "Not empty" || echo "Empty" Please...
View ArticleDisplaying Column header in shell script
Hi, I need to display specific columns using select statement and spooled to a file and sending it as e-mail. But i am not seeing column header in my output even i use SET HEADING ON. Code:...
View ArticleDouble quote in vimrc not take as comment
Hi, 1. I'm using tcsh and I use a .gvimrc file which was working fine with my previous ksh shell. But while sourcing, I'm getting messages like 'Unmatched " '. I'm not trying anything fancy but just...
View ArticleSET command
Hi Friends, There is an command that, SET -x I am confused with the SET command , i have gone through man page but still. could anyone advise the same and necessity of the SET command ? Regards, Nantha.
View ArticleHelp! Printing out CSV output from awk Pattern Match
Hi, I need to search for a word using Awk and print out the line the word is in and every line after the search phrase until I hit this #------------ . Then I need to send it to a csv file. So...
View Articlesed - specific line
Hi all ! Please see if you can help me. I've used sed comand (with success) to remove content from the file when some word is found. Example: Into to the file (FILE.txt) I've: Code:...
View ArticleVim line length...
The vi(m) text editor... Google is not my friend here... I have already found out that it is possible to save a pure text file without the '0x0A' newline character at the very end of the file but I...
View ArticleExpect - assigning UNIX command output to a variable
Hi, I'm writing a script that connects through ssh (using "expect") and then is supposed to find whether a process on that remote machine is running or not. Here's my code (user, host and password are...
View ArticleDeleting lines on matching certain pattern
hi I have a large xml file from which i have taken few lines . In this file I have to find for the string </invoices> and check if the 3 rd line after this string does not begin with...
View ArticleGrep for a word or word with underscore
I have a file "test" with following contents: Code: cat test abc abcd_efg abc_abc I want to only grep for abc or abc_ without getting other results, how do I achieve this? If I use Code: grep -w abc...
View Articlesed find/replace a pattern, but not this one..
I've got a file like so: Code: ...lots of lines, etc. push "route 10.8.0.0 255.255.255.0" push "route 192.168.1.123 255.255.255.0" ...lots of lines, etc. I want to sed find/replace the IP address in...
View ArticleUndefined variable error
I am getting the error undefined variable even after following these steps #read name abcd #echo $name na: undefined variable
View Article