Sponsored Content
Top Forums Shell Programming and Scripting Use awk/sed/grep with goto statement! Post 302594583 by dixits on Tuesday 31st of January 2012 05:27:48 PM
Old 01-31-2012
Use awk/sed/grep with goto statement!

Hi,
I have an array with characters and I am looking for specific character in that array and if those specific character not found than I use goto statment which is define somehwhere in the script. My code is:
Code:
set a = (A B C D E F)
@ i = 0
while ($i <= ${#a})
  if ($a[$i] != "F" || $a[$i] != "D") then
    goto USAGE
  endif
@ i++
end

Can this be done in one line using awk/sed/grep? That is if this array has characters other than D or F than goto statement should be executed. That is I expect array a with only D and F .
Thank you so much for your help in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use of GOTO statement in scripts

Hey Guys.. I just want to know how to use Goto statement in shell scripts. I know the basic use of statement. Goto Label The above statement will search for some label which must be defined in the script itself as: label: I tried these combinations but I didn't work out for me and I'm... (7 Replies)
Discussion started by: vikasduhan
7 Replies

2. Shell Programming and Scripting

goto statement

I have a test script for using goto statement but its not working. please help i tried both in linux and hp-ux it's not working please help #! /bin/ksh t=`ps -ef|grep ti.sh|grep -v grep` if ; then goto start else goto stop fi start: echo "start" stop: echo "stop" (5 Replies)
Discussion started by: Krrishv
5 Replies

3. Shell Programming and Scripting

sed / grep / for statement performance - please help

I'm searching the most effective way of doing the following task, so if someone can either provide a working solution with sed or one totally different but more effective then what I've got so far then please go ahead! The debugme directory has 3 subdirectorys and each of them has one .txt file... (7 Replies)
Discussion started by: TehOne
7 Replies

4. Shell Programming and Scripting

Goto each directory and subdirectories and grep the required pattern

Hi All, I need your help in finding pattern from files present in different directories. I need to search for a pattern "xyz" from "*.txt" files which are present in different levels of directories as shown. example ------- dir1/subdir1/file.txt dir2/subdir2/subsubdir2/file.txt... (5 Replies)
Discussion started by: imas
5 Replies

5. Shell Programming and Scripting

Grep/awk/sed help

got a file as y.txt 1 abc,def,ghj 2 defj,abc.kdm,ijk 3 lmn,cbk,mno 4 tmp,tmop,abc,pkl 5 pri,chk,cbk,lmo 6 def,cbk.pro,abc.kdm i want to search in the above file the key word like abc looking for two outcomes by passing the parameter value as abc into function and the two outocmes are... (6 Replies)
Discussion started by: silgun
6 Replies

6. Shell Programming and Scripting

Awk/sed problem to write Db insertion statement

Hi There, I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB My exiting csv record... (6 Replies)
Discussion started by: bhaskar_m
6 Replies

7. Shell Programming and Scripting

awk statement to grep (bit involved)

Hellow: I have the following data. id1 xxx xxx xxx id1 xxxx xxx xxx id2 xxx xxx xxx id2 xxxx xxx xxx id2 In my awk script which reads the file containing the above data I have the following code: myline=<inputdata> which is shown above What I am trying to find out is how may... (5 Replies)
Discussion started by: wincrazy
5 Replies

8. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

9. Shell Programming and Scripting

sed within awk statement

input | Jan 8 2018 11:28PM| 24 | 75 | 51 | 1 | 1.600| | Jan 8 2018 12:01PM| 52 | 823 | 21 | 6 | 2.675| desired output Jan-8-2018-11:28PM 24 75 51 1 1.600 Jan-8-2018-12:01PM 52 823 21 6 2.675 Dear friends, I have input file , as shown above and... (10 Replies)
Discussion started by: sagar_1986
10 Replies

10. Shell Programming and Scripting

awk statement piped inside sed

Hello folks, I have multiple occurrences of the pattern: ).: where is any digit, in various text context but the pattern is unique as this regex. And I need to turn this decimal fraction into an integer (corresponding percent value: the range of 0-100). What I'm doing is: cat... (1 Reply)
Discussion started by: roussine
1 Replies
wcsftime(3C)						   Standard C Library Functions 					      wcsftime(3C)

NAME
wcsftime - convert date and time to wide character string SYNOPSIS
#include <wchar.h> XPG4 and SUS size_t wcsftime(wchar_t *wcs, size_t maxsize, const char *format, const struct tm *timptr); Default and other standards size_t wcsftime(wchar_t *restrict wcs, size_t maxsize, const wchar_t *restrict format, const struct tm *restrict timptr); DESCRIPTION
The wcsftime() function is equivalent to the strftime(3C) function, except that: o The argument wcs points to the initial element of an array of wide-characters into which the generated output is to be placed. o The argument maxsize indicates the maximum number of wide-characters to be placed in the output array. o The argument format is a wide-character string and the conversion specifications are replaced by corresponding sequences of wide-characters. o The return value indicates the number of wide-characters placed in the output array. If copying takes place between objects that overlap, the behavior is undefined. RETURN VALUES
If the total number of resulting wide character codes (including the terminating null wide-character code) is no more than maxsize, wcsf- time() returns the number of wide-character codes placed into the array pointed to by wcs, not including the terminating null wide-charac- ter code. Otherwise, 0 is returned and the contents of the array are indeterminate. The wcfstime() function uses malloc(3C) and should malloc() fail, errno will be set by malloc(). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe with exceptions | +-----------------------------+-----------------------------+ SEE ALSO
malloc(3C), setlocale(3C), strftime(3C), attributes(5), standards(5) NOTES
The wcsftime() function can be used safely in multithreaded applications, as long as setlocale(3C) is not being called to change the locale. SunOS 5.11 1 Nov 2003 wcsftime(3C)
All times are GMT -4. The time now is 12:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy