10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Looking for help,
i have input file like below and want to modify to expected output, if can without create additional file, hope can direct modify it.
have 2 thing need do.
1st
is adding a word (testplan generation off) after ! ! IPG: Tue Aug 07 14:31:17 2018
2nd
is adding... (16 Replies)
Discussion started by: kttan
16 Replies
2. Shell Programming and Scripting
Hello Everyone ,
I have two files. I want to pick line from file-1 and match with the complete data in file-2 , if there is a match print all the match lines in file 3. Below is the file
cat test1.txt
vikas
vikasjain
j ain
testt
douknow
hello@vik@
# 33
||@@ vcpzxcmvhvdsh... (1 Reply)
Discussion started by: mailvkjain
1 Replies
3. Shell Programming and Scripting
Hi All,
From the below line if we want to display all the text till found pattern dot/. I was trying with the below code but couldn't able
to print text before the pattern. it display texts which is found after pattern.
awk '/assed/{print;getline;print}' file_name | sed 's/^*. *//'
input... (4 Replies)
Discussion started by: Optimus81
4 Replies
4. Shell Programming and Scripting
Hi,
I need something unusual, I guess. I need to start a process, and if that process displays a specific error message, I need to kill that process and restart it.
Something like:
startprocess | grep -i "This is the specific error message" && kill $pidof(startprocess)
Explanation, I need... (4 Replies)
Discussion started by: burek
4 Replies
5. Solaris
Hi all,
Is it possible for grep to output just the pattern match and not the whole line when it comes across a match? I know you can adjust the number of trailing or leading lines that are printed, but am yet to find anything that outputs just the pattern match.
Cheers,
Tim (5 Replies)
Discussion started by: muzzaw
5 Replies
6. Shell Programming and Scripting
Hi there
I would like to search a file for a certain pattern, but i don't know the exact pattern i need to search for.
What i do know is that i need to search for the pattern that exists the most in a certain file.
so if a file looksike this:
summer, summer, winter, spring, summer... (4 Replies)
Discussion started by: mrchilly
4 Replies
7. UNIX for Advanced & Expert Users
Hi
How to prevent grep command from throwing a system trap(or returning error status) if No match is found in the specified file(s) ?
Consider this simple shell script:
#!/usr/bin/ksh
trap 'STATUS=$?;set +x;echo;echo error $STATUS at line nb $LINENO executing :\
`sed -n... (2 Replies)
Discussion started by: cool.aquarian
2 Replies
8. UNIX for Dummies Questions & Answers
Hello,
How do I use grep to find a pattern in a list of file and then display 5 lines after the pattern is matched
Eg:
I want to match the string GetPresentCode in all files in a folder and then see 4 lines following this match. I am not sure if grep is what should be used to achieve. Thanks!... (3 Replies)
Discussion started by: cv_pan
3 Replies
9. Shell Programming and Scripting
Hi,
I try to grep lines with pattern like
float_or_int float_or_int float_or_int
where float_or_int is any float or any integer of any length.
I tried some :
grep "* * *" FILENAME #Work for integers but not for floats
grep '\<.*\> \<.*\> \<.*\>' FILENAME #Work for float but not... (4 Replies)
Discussion started by: tipi
4 Replies
10. UNIX for Dummies Questions & Answers
hi,
i'm having problem like this.
i wish to grep some keyword from certain files in one directory.
let's say i have a lot of files in my directory with the name of file.1 file.2 file.3 ...... file.500
i only wish to grep the keyword from file.20, file.21, file.23 .... file.50
i tried... (5 Replies)
Discussion started by: rei
5 Replies