10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
Below command trims right after the nth occurrence of a string.
When I try in while loop, it is not working.
In Terminal
IFS=/ ; read -ra val < Textfile ; echo "${val:0:3}"
It gives only one line:
sunday/monday/tuesday
Textfile:
sunday/monday/tuesday/wednesday/thursday... (2 Replies)
Discussion started by: baris35
2 Replies
2. Shell Programming and Scripting
Hi All,
I am very new to shell scripting and tried to search this in the forum but no luck.
Requirment:
I have an input file which is comma separated. I need to replace the value in 4th column with another value. This has to happen for all the lines in the file.
Sample data:
Input... (2 Replies)
Discussion started by: arunkumarsd
2 Replies
3. Shell Programming and Scripting
Please can someone help with this?
I have a file with lines as follows:
word1 word2 word3 word4 word5 word6 word7 word8
word1 word2 word3 word4 word5 word6 word7 word8
word1 word2 word3 word4 word5 word6 word7 word8
word1 word2 word3 word4 word5 word6 word7 word8
When I use the... (7 Replies)
Discussion started by: Subhadeep_Sahu
7 Replies
4. Shell Programming and Scripting
Hi,
I am getting crazy after days on looking at it:
Bash in Ubuntu 12.04.1
I want to do this:
pattern="system /path1/file1 file1"
new_pattern=" data /path2/file2 file2"
file to edit: data.db
- I need to search in the file data.db for the nth occurrence of pattern
- pattern must... (14 Replies)
Discussion started by: Phil3759
14 Replies
5. Shell Programming and Scripting
Greetings experts. Searched the forums (perhaps not hard enough?) - Am searching for a method to capture all output from a log file following the nth occurrence of a known string.
Background:
Using bash, I want to monitor my Oracle DB alert log file. The script will count the total # of... (2 Replies)
Discussion started by: cjtravis
2 Replies
6. Shell Programming and Scripting
There is already one thread with the same heading. But here the case is little different.
i have a line which have a field separator '|'
abc|def|ghi|jkl|mno|pqr|stu|vwx|yz
I want to replace every 3rd occurance + next character with the same + newline character.. I mean i want to enter a... (6 Replies)
Discussion started by: ratheeshjulk
6 Replies
7. Shell Programming and Scripting
Hi
I have requirement to find nth occurrence in a file and capture data from with in lines (between lines)
Data in File.
<QUOTE>
<SESSION>
<ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/>
<ATTRIBUTE NAME='Service Name' VALUE='None'/>
</SESSION>
<SESSION>
<ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies
8. Shell Programming and Scripting
Hi all,
assume that i am having the following line in a file called file1.
triumph and disaster must be treated same.
I want to replace this line with.
follow excellence success will chase you.
is it possible to do this using sed. if possible kindly post me the... (2 Replies)
Discussion started by: anishkumarv
2 Replies
9. UNIX for Dummies Questions & Answers
I have several files (around 50) that have the similar format. I need to extract the 5th line from every file and output that into a text file. So far, I have been able to figure out how to do it for a single file:
$ awk 'NR==5' text1.txt > results.txt
OR
$ sed -n '5p' text1.txt > results.txt... (6 Replies)
Discussion started by: oriqin
6 Replies
10. Shell Programming and Scripting
Hello All,
How to replace a string in nth line of a file using sed or awk.
For Ex: test.txt
Line 1 : TEST1 TEST2 TEST3
Line 2 : TEST1 TEST2 TEST3 TEST4
Line 3 : TEST1 TEST2 TEST3 TEST5
Line 4 : TEST1 TEST2 TEST3 TEST6
Line 5 : TEST1 TEST2 TEST3 TEST7
i want to go to 4th line of a... (1 Reply)
Discussion started by: maxmave
1 Replies