10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Folks,
Need to bisect strings based on a subset.
Below works good.
echo /a/b/c/d | awk -F"/c/d$" '{print $1}'
/a/b
However, it goes awry with special characters.
echo /a/b/c+/d | awk -F"/c+/d$" '{print $1}'
/a/b/c+/d
Desired output:
/a/b
Escaping the special characters... (11 Replies)
Discussion started by: vibhor_agarwali
11 Replies
2. Shell Programming and Scripting
This is really frustrating because I can't figure it out.
I'm running a health check script. One of the items I'm checking is the amount of memory on a server. I use the free command, which outputs something like this (excerpt)
Mem: 100 100 100 100
Swap: 100 100 100 100
In my debugging... (5 Replies)
Discussion started by: JustaDude
5 Replies
3. Shell Programming and Scripting
grep -i "$line,$opline" COMBO_JUNK|awk -F, '
{
C4+=$4
}
{
}
END {
print C4
}
' OFS=,`
when i run this command in the script.... it o/p all the value as 0 if $line contains any special parameters.....
but the same script if i run in command prompt... it shows... (4 Replies)
Discussion started by: nikhil jain
4 Replies
4. Shell Programming and Scripting
Hi,
I am facing a below problem. Inorder to mak sure the below file is fixed width i am using the following command
awk '{printf("%-375s\n", $0) } so as to add trailing spaces at the end for records of length less than 375.
Input file > inp.txt
1©1234
1234
123©1
The output file is... (1 Reply)
Discussion started by: marcus_kosaman
1 Replies
5. Shell Programming and Scripting
Hi Experts.
I'm stuck with the below AWK code where i'm trying to move the records containing any special characters in the last field to a bad file.
awk -F, '{if ($NF ~ /^|^/) print >"goodfile";else print >"badfile"}' filename
sample data
1,abc,def,1234,A *
2,bed,dec,342,* A ... (6 Replies)
Discussion started by: shell_boy23
6 Replies
6. Shell Programming and Scripting
I'm using awk '{print $1}' and it works most of the time to print the contents of a mysql query loop, but occationally I get a field with some special character in it, is there a way to tell awk to ignore all special characters between my FS? I have >186K records, so building a list of ALL special... (6 Replies)
Discussion started by: unclecameron
6 Replies
7. Shell Programming and Scripting
Hi All,
I have a CSV file in which some fields contains special character for ex:-
my file is file 1
cat file1
abcd,bgfht,ngbht,abvc ****
hdlld,hsgdt,bhfy,knht ****
whenever i am trying to put a 4th feild in a variable its giving me list of all the files i have in current... (6 Replies)
Discussion started by: sam25
6 Replies
8. HP-UX
Hi all,
We are facing the following problem in our HP-UX machine: software that manipulates utf-8 encoded strings (e.g. during string cut), fails to correctly manipulate strings (all containing Greek characters) that contain special characters like @, &, # etc. Actually, in different... (3 Replies)
Discussion started by: alina
3 Replies
9. Shell Programming and Scripting
Hi all,
How do I extract a value without special characters? I need to extract the value of %Used from below and if its greater than 80, need to send a notification.
I am doing this right now..Its giving 17%..Is there a way to extract the value and assign it to a variable in one step?
df |grep... (3 Replies)
Discussion started by: sam_78_nyc
3 Replies
10. Shell Programming and Scripting
i have this script that searches for a pattern.
However it fails if the pattern includes some
special characters. So far, it fails with the
following strings:
1. -Cr
2. $Mj
3. H'412
would a sed or awk be more effective?
i don't want the users to put the (\)
during the search (they... (5 Replies)
Discussion started by: apalex
5 Replies