10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm just learning Regex and while testing my understanding I received some unexpected results.
I created example.txt with the text "abcddd". Running the command
grep --color 'd' example.txt
I received the results:
"abcddd" with the first and second letter d highlighted in red.
So... (1 Reply)
Discussion started by: rthomas529
1 Replies
2. Shell Programming and Scripting
I am using a regex to exactly match a string abcdef as ^abcdef$. But it does'nt seem to work :( (11 Replies)
Discussion started by: gaurav99
11 Replies
3. UNIX for Dummies Questions & Answers
I have a number of files that I pass through awk/gsub.
I believe to have found a working regex and on 'test bed' sites it matches, however within gsub it does not.
Examples:
Initial data:
/Volumes/Daniel/Public/Drop Box/_Hellsing_Ultimate_OVA_-_10_.mkv
gsub & regex:
gsub("\]+\]",""
... (4 Replies)
Discussion started by: unknownn
4 Replies
4. Shell Programming and Scripting
I have below inside a file.
11.22.33.44
user1
11.22.33.55
user2
I need this manipulated as
alias server1.domain.com='ssh user1@11.22.33.44'
alias server2.domain.com='ssh user2@11.22.33.55' (3 Replies)
Discussion started by: anil510
3 Replies
5. Shell Programming and Scripting
Hello, would you please help me with why my SED command file is outputting the entire input file instead of only the text that I'm trying to block?
cat testfile
O 111111111-00
DUE-DATE
METHOD:
FREQUENCY:
O 222222222-00
DUE-DATE
METHOD:
FREQUENCY:
O 333333333-02
DUE-DATE
METHOD:... (4 Replies)
Discussion started by: lneedh1
4 Replies
6. Shell Programming and Scripting
Hi,
I'm trying to validate if a string matches a regular expression, but it is not working. Am I missing something? Do I need to scape any of the characters?
if echo 'en-GB' | egrep '({1,8})(-{1,8})*' >/dev/null; then
echo Valid value
fi
Thanks in advance (6 Replies)
Discussion started by: skrtxao
6 Replies
7. UNIX for Dummies Questions & Answers
Hi Forum
im trying to use grouping in a regex statement in a function in a script
this is the criteria im trying to match :It MUST have 3 character at the beginning. After that it can have a mix of spaces,alpha-numeric and dashes in any order
eg HUG this-stuff, FGU taylor-8-shoes, ZDFnintendo... (2 Replies)
Discussion started by: ShinTec
2 Replies
8. Shell Programming and Scripting
I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly:
if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies
9. Shell Programming and Scripting
Hi,
I have the following script :-
#!/bin/csh -f
set var="HOST2"
sed -e 's/\(.*TRANSFER TO\).*\(usr\)/\1 "$var" \2/' tempFile
tempFile contains:
STOP TRANSFER TO HOST1 /usr/bin/myscript
1. How to use variable in the above sed command. It replaces with $var... (6 Replies)
Discussion started by: angshuman_ag
6 Replies
10. Shell Programming and Scripting
I run awk
cat $1|awk '{print $6}'
and get a lot of results and I want results to group them. For example my result is (o/p is unknown to user)
xyz
xyz
abc
pqr
xyz
pqr
etc
I wanna group them as
xyz=total found 7
abc=total ....
pqr=
Thank (3 Replies)
Discussion started by: pujansrt
3 Replies