Sponsored Content
Full Discussion: Grep command error
Top Forums Shell Programming and Scripting Grep command error Post 302788281 by Scrutinizer on Monday 1st of April 2013 12:05:34 PM
Old 04-01-2013
What do you use for story. Do you use proper quoting around it?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep command

Hi, I'd like to use grep command to filter something from all the directories that above my directory. How do I do that? I tried 'grep something ./*' but I didn't get anything which I knew there is something inside one of the subdirectory. thnks! (3 Replies)
Discussion started by: whatisthis
3 Replies

2. UNIX for Advanced & Expert Users

how to exclude the GREP command from GREP

I am doing "ps -f" to see my process. but I get lines that one of it represents the ps command itself. I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself : I would like to exclude # ps -f UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Discussion started by: yamsin789
2 Replies

3. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

4. Shell Programming and Scripting

Grep Command

Hi, I Want to grep the 500th character of a line in a file. please help on this. Thanks in advance (7 Replies)
Discussion started by: raghulshekar
7 Replies

5. Shell Programming and Scripting

grep only last occurred error in error.log,

hi folk i need your help to find one logic.... i have error log same as any other error logs which get populated by no of events and errors... but i need to grep the last occured errors.. which cant be duplicate. here is my script. ======================== #!/usr/bin/ksh grep -i... (3 Replies)
Discussion started by: tapia
3 Replies

6. Shell Programming and Scripting

Help with using grep command with copy command

Hi, im taking an entry Unix class, and as part of my lab assignment I have to copy all files in the /home/david/lab3 directory that have the file extension .save to your lab3/temp directory. I'm having trouble getting the grep to do anything worth while I've been trying to do: cp... (6 Replies)
Discussion started by: Critical jeff
6 Replies

7. UNIX for Dummies Questions & Answers

how to use And/Or in grep command?

dears how can i use And/Or in grep expression? thanks alot (3 Replies)
Discussion started by: thehero
3 Replies

8. Shell Programming and Scripting

Supressing error while using grep command

I am tryin to grep some pattern in file and redirecting it in to another file. If the file doesn't exist then it should not throw error. eg : grep "pattern" "$path1/filename" >> newfile I have multiple number of grep statement like this. so i cant check each and every is exist or not... ... (1 Reply)
Discussion started by: arukuku
1 Replies

9. UNIX for Dummies Questions & Answers

Grep command

I am using below command to grep a string in all the dir/subdir: find /home -exec grep 'balance1212' {} /dev/null \; I'm getting a lot of lines like below: grep: can't open /home/shared/argr find: cannot open /home/shared/srpt/.ssh I want to see only the file having the string... (1 Reply)
Discussion started by: ravigupta2u
1 Replies

10. Shell Programming and Scripting

Grep command giving different result for different users for same command

Hello, I am running below command as root user #nodetool cfstats tests | grep "Memtable switch count" Memtable switch count: 12 Where as when I try to run same command as another user it gives different result. #su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies
Tcl_SplitList(3)					      Tcl Library Procedures						  Tcl_SplitList(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_SplitList, Tcl_Merge, Tcl_ScanElement, Tcl_ConvertElement, Tcl_ScanCountedElement, Tcl_ConvertCountedElement - manipulate Tcl lists SYNOPSIS
#include <tcl.h> int Tcl_SplitList(interp, list, argcPtr, argvPtr) char * Tcl_Merge(argc, argv) int Tcl_ScanElement(src, flagsPtr) int Tcl_ScanCountedElement(src, length, flagsPtr) int Tcl_ConvertElement(src, dst, flags) int Tcl_ConvertCountedElement(src, length, dst, flags) ARGUMENTS
Tcl_Interp *interp (out) Interpreter to use for error reporting. If NULL, then no error message is left. char *list (in) Pointer to a string with proper list structure. int *argcPtr (out) Filled in with number of elements in list. const char ***argvPtr (out) *argvPtr will be filled in with the address of an array of pointers to the strings that are the extracted elements of list. There will be *argcPtr valid entries in the array, followed by a NULL entry. int argc (in) Number of elements in argv. const char *const *argv (in) Array of strings to merge together into a single list. Each string will become a separate ele- ment of the list. const char *src (in) String that is to become an element of a list. int *flagsPtr (in) Pointer to word to fill in with information about src. The value of *flagsPtr must be passed to Tcl_ConvertElement. int length (in) Number of bytes in string src. char *dst (in) Place to copy converted list element. Must contain enough characters to hold converted string. int flags (in) Information about src. Must be value returned by previous call to Tcl_ScanElement, possibly OR- ed with TCL_DONT_USE_BRACES. _________________________________________________________________ DESCRIPTION
These procedures may be used to disassemble and reassemble Tcl lists. Tcl_SplitList breaks a list up into its constituent elements, returning an array of pointers to the elements using argcPtr and argvPtr. While extracting the arguments, Tcl_SplitList obeys the usual rules for backslash substitutions and braces. The area of memory pointed to by *argvPtr is dynamically allocated; in addition to the array of pointers, it also holds copies of all the list elements. It is the caller's responsibility to free up all of this storage. For example, suppose that you have called Tcl_SplitList with the following code: int argc, code; char *string; char **argv; ... code = Tcl_SplitList(interp, string, &argc, &argv); Then you should eventually free the storage with a call like the following: Tcl_Free((char *) argv); Tcl_SplitList normally returns TCL_OK, which means the list was successfully parsed. If there was a syntax error in list, then TCL_ERROR is returned and the interpreter's result will point to an error message describing the problem (if interp was not NULL). If TCL_ERROR is returned then no memory is allocated and *argvPtr is not modified. Tcl_Merge is the inverse of Tcl_SplitList: it takes a collection of strings given by argc and argv and generates a result string that has proper list structure. This means that commands like index may be used to extract the original elements again. In addition, if the result of Tcl_Merge is passed to Tcl_Eval, it will be parsed into argc words whose values will be the same as the argv strings passed to Tcl_Merge. Tcl_Merge will modify the list elements with braces and/or backslashes in order to produce proper Tcl list structure. The result string is dynamically allocated using Tcl_Alloc; the caller must eventually release the space using Tcl_Free. If the result of Tcl_Merge is passed to Tcl_SplitList, the elements returned by Tcl_SplitList will be identical to those passed into Tcl_Merge. However, the converse is not true: if Tcl_SplitList is passed a given string, and the resulting argc and argv are passed to Tcl_Merge, the resulting string may not be the same as the original string passed to Tcl_SplitList. This is because Tcl_Merge may use backslashes and braces differently than the original string. Tcl_ScanElement and Tcl_ConvertElement are the procedures that do all of the real work of Tcl_Merge. Tcl_ScanElement scans its src argu- ment and determines how to use backslashes and braces when converting it to a list element. It returns an overestimate of the number of characters required to represent src as a list element, and it stores information in *flagsPtr that is needed by Tcl_ConvertElement. Tcl_ConvertElement is a companion procedure to Tcl_ScanElement. It does the actual work of converting a string to a list element. Its flags argument must be the same as the value returned by Tcl_ScanElement. Tcl_ConvertElement writes a proper list element to memory start- ing at *dst and returns a count of the total number of characters written, which will be no more than the result returned by Tcl_ScanEle- ment. Tcl_ConvertElement writes out only the actual list element without any leading or trailing spaces: it is up to the caller to include spaces between adjacent list elements. Tcl_ConvertElement uses one of two different approaches to handle the special characters in src. Wherever possible, it handles special characters by surrounding the string with braces. This produces clean-looking output, but cannot be used in some situations, such as when src contains unmatched braces. In these situations, Tcl_ConvertElement handles special characters by generating backslash sequences for them. The caller may insist on the second approach by OR-ing the flag value returned by Tcl_ScanElement with TCL_DONT_USE_BRACES. Although this will produce an uglier result, it is useful in some special situations, such as when Tcl_ConvertElement is being used to gen- erate a portion of an argument for a Tcl command. In this case, surrounding src with curly braces would cause the command not to be parsed correctly. By default, Tcl_ConvertElement will use quoting in its output to be sure the first character of an element is not the hash character ("#".) | This is to be sure the first element of any list passed to eval is not mis-parsed as the beginning of a comment. When a list element is | not the first element of a list, this quoting is not necessary. When the caller can be sure that the element is not the first element of a | list, it can disable quoting of the leading hash character by OR-ing the flag value returned by Tcl_ScanElement with TCL_DONT_QUOTE_HASH. Tcl_ScanCountedElement and Tcl_ConvertCountedElement are the same as Tcl_ScanElement and Tcl_ConvertElement, except the length of string src is specified by the length argument, and the string may contain embedded nulls. KEYWORDS
backslash, convert, element, list, merge, split, strings Tcl 8.0 Tcl_SplitList(3)
All times are GMT -4. The time now is 10:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy