sed / grep / for statement performance - please help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed / grep / for statement performance - please help
# 8  
Old 11-05-2009
Okey thanks alot, also the code I've posted was only an example and in my real script there's a different regex pattern then ^\([0-9]\+\)$ so that might be the reason why it's not working.

That's how I've got it set:

Code:
for FILE in `awk '{print $1}' "$FILE" | grep -i '\(rar\|r[0-9]\+\)$'` ;do

I do not really understand how t[1]+0 == t[1] is equivalent to grep -i '^\([0-9]\+\)$... But how would I make it work for the real patter I use? (grep -i '\(rar\|r[0-9]\+\)$')

Last edited by TehOne; 11-05-2009 at 02:45 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Performance improvement in grep

Below script is used to search numeric data from around 400 files in a folder. I have 300 such folders. Need help in performance improvement in the script. Below Script searches 20 such folders ( 300 files in each folder) simultaneously. This increases cpu utilization upto 90% What changes... (3 Replies)
Discussion started by: vegasluxor
3 Replies

3. Shell Programming and Scripting

Using GREP in IF Statement

Hello All, I have 2 different pieces of code, I am confused why the Code1 is giving me the correct result where as the Code2 is not giving me correct result. It gives me always result as "Failure" irrespective of the "ERROR" word exists in logfile or not. may I know the reason why? I am using Bash... (17 Replies)
Discussion started by: Ariean
17 Replies

4. Shell Programming and Scripting

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: set a = (A B C D E F) @ i = 0 while ($i <= ${#a}) if ($a != "F" || $a != "D")... (3 Replies)
Discussion started by: dixits
3 Replies

5. Programming

Help with improve the performance of grep

Input file: #content_1 12314345345 242467 #content_14 436677645 576577657 #content_100 3425546 56 #content_12 243254546 1232454 . . Reference file: content_100 (1 Reply)
Discussion started by: cpp_beginner
1 Replies

6. Shell Programming and Scripting

performance of shell script ( grep command)

Hi, I have to find out the run time for 40-45 different componets. These components writes in to a genreric log file in a single directory. eg. directory is LOG and the log file name format is generic_log_<process_id>_<date YY_MM_DD_HH_MM_SS>.log i am taking the run time using the time... (3 Replies)
Discussion started by: vikash_k
3 Replies

7. Shell Programming and Scripting

Grep statement

Hi All, Please can somebody advise that if I want to search a pattern xyz the grep command should only select xyz and not any other pattern containing xyz (ex abxyzcd) Regards (1 Reply)
Discussion started by: Shazin
1 Replies

8. UNIX for Advanced & Expert Users

sed performance

hello experts, i am trying to replace a line in a 100+mb text file. the structure is similar to the passwd file, id:value1:value2 and so on. using the sed command sed -i 's/\(123\):\(\{1,\}\):/\1:bar:/' data.txt works nicely, the line "123:foo:" is replaced by "123:bar:". however, it takes... (7 Replies)
Discussion started by: f3k
7 Replies

9. Shell Programming and Scripting

How to improve grep performance...

Hi All, I am using grep command to find string "abc" in one file . content of file is *********** abc = xyz def= lmn ************ i have given the below mentioned command to redirect the output to tmp file grep abc file | sort -u | awk '{print #3}' > out_file Then i am searching... (2 Replies)
Discussion started by: pooga17
2 Replies

10. Shell Programming and Scripting

Using grep in if statement

Can somebody please guide me towards right syntax: #!/bin/ksh if i = $(grep $NAME filename) echo "Name Found" else echo " Name not Found" fi I need to grep for $NAME in the file, and if it returns false, execute a series of commands and if true, exit out. The above is not the right... (3 Replies)
Discussion started by: chiru_h
3 Replies
Login or Register to Ask a Question
chroot(2)							System Calls Manual							 chroot(2)

NAME
chroot - Changes the effective root directory SYNOPSIS
#include <unistd.h> int chroot ( const char *path ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: chroot(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to the new effective root directory. If the path parameter refers to a symbolic link, the chroot() function sets the effective root directory to the directory pointed to by the symbolic link. DESCRIPTION
The chroot() function causes the directory named by the path parameter to become the effective root directory. The effective root directory is the starting point when searching for a file's pathname that begins with a / (slash). The current working directory is not affected by the chroot() function. The calling process must have superuser privilege in order to change the effective root directory. The calling process must also have search access to the new effective root directory. The .. (dot-dot) entry in the effective root directory is interpreted to mean the effective root directory itself. Thus, .. (dot-dot) can- not be used to access files outside the subtree rooted at the effective root directory. RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. If the chroot() function fails, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the chroot() function fails, the effective root directory remains unchanged and errno may be set to one of the following values: Search permission is denied for any component of the pathname. The path parameter points outside the process' allocated address space. An I/O error occurred while reading from or writing to the file system. More than MAXSYMLINKS symbolic links are encountered while resolving path. The length of the path argument exceeds PATH_MAX or a pathname component is longer than NAME_MAX. The path parameter does not exist or points to an empty string. A component of path is not a directory. The process does not have appropriate privilege. RELATED INFORMATION
Functions: chdir(2) Commands: cd(1) Standards: standards(5) delim off chroot(2)