1. There should be a space between awk and -F
2. There should be no space between $ and 12
3. Since the field can be 3 or 4 characters I would not use substr , but use a pattern match:
4. Use curly braces instead of parentheses in most places
5. If you use 20100525 * it means read file named "20100525" and subsequently read any file in the directory including file "20100525"for the second time if it exists. Do you mean 20100525* (any file that begins with 20100525)?
After applying these changes you end up with something like this:
This User Gave Thanks to Scrutinizer For This Post:
so i'm running a variation of the following command a few times in my script:
echo "${TOTALRunning}" | awk -F"" '/'"${PROCSEARCH}"'/ {print $2}' | tr '\n' '|'
unfortunately i cant paste the content of the variable TOTALRunning into this thread for security reasons.
what i want to do is... (9 Replies)
I need to create one script in which I want to search in txt file , this txt file is having 10 columns , I want to check 4th column value if "BOY" & 10th column value =>500 it will print 4th column row value ,1st column row value & 10th column row value & store the same value in one file as... (2 Replies)
This code shal search for the non-breaking space 0xA0 though it returns the error "fatal: attempt to use scalar 'nbs' as array" Can somebody help?
awk --non-decimal-data -v nbs="0xA0" '{if($0 in nbs) {print FILENAME, NR}}' *.txt (1 Reply)
I want to search a file in a specific location and I don't want to use find command.
I want to give the path also where the file is for searching it. Pls help (3 Replies)
Hi...
I am working on script to search some records in a file based on certain fields and each record is a ASCII fixed size. I was using awk to search based on certain condition. But the length of the record is too much that awk is giving
syntax error near unexpected token `('
Request... (5 Replies)
Hi, I wonder if anybody could help. How do i awk out (or indeed using another utility) a particular value that exists within a defined block, for example if i have a file that looks like the one below and i want to get at the "Product Serial" for the block referring to "mb.fru" (bolded and coloured... (4 Replies)
Hello everyone!
I use a script to query for installed packages with yum (I use RHEL 4 with yum installed) and the output is redirected to a file. My script scan this file to find a package and the version of it.
The script works fine until I search for a package name with special characters.... (3 Replies)
hi there,
im writing some script in awk; in few words i have a list from router (mac address- ip address) and the second list with only the mac addresses.
the thing is that i want search list from router for the first mac address; if found - print the ip address, if not print error; then search... (1 Reply)