10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
I'm trying to add a new line after finding a specific String.
That is my string:
volumes:
- ${DIR_WORK}/loadbalancer/html:/var/www/html
and I want to change that file to:
volumes:
- ${DIR_WORK}/loadbalancer/html:/var/www/html
extra_hosts:
-... (4 Replies)
Discussion started by: siamak
4 Replies
2. Shell Programming and Scripting
Hi All,
I am trying to write a shell script where it should insert character 'I' in 180th position of each line(except first and last line) of the file. Below is the script
for file in /home/test/bharat/*.RET
do
# Process file
echo "File Name=" $file
#l_fileName="${file##*/}"
... (19 Replies)
Discussion started by: bharath561989
19 Replies
3. Shell Programming and Scripting
Hi,
If my first character of a line starts with 2 then after 5th charecter newline character should be inserted.
Input.txt:
a1234567890
2222300007
bsdfsdf888999999
ssdfkjskfdjskfdjd
2899900000000099999999999999
28887777
999999999999999999
Output.txt:
a1234567890
22223
00007... (8 Replies)
Discussion started by: unme
8 Replies
4. Shell Programming and Scripting
I have a file and I can get the line with a specific pattern. I want to inset # on start of the line.
file.text
====
aa bb cc
bb hh kk
kk ll yy
dd aa kk
rr tt aa
I want to comment out the line with contain "aa"
after running the script
file.text
====
#aa bb cc
bb hh kk
kk ll... (7 Replies)
Discussion started by: Biplab
7 Replies
5. Shell Programming and Scripting
I need an awk script that returns the 1st field of the line in the middle of a file. For example, if a file I have has 6 lines, I want it to return the 1st field on line number 3. If a file has 7 lines, I want the script to return the 1st field on line number 4.
File1:
3 214
4 219
5 226
2... (8 Replies)
Discussion started by: jontjioe
8 Replies
6. UNIX for Dummies Questions & Answers
exmaple, i need to replace the number "5" from all lines below with "X"?
What is the useful vim command that i can apply for..
ddpadsgg506xghssuyj
ddpadsgag546xghssuys
ddsadsgaag596xghssuy_te
ddsadsgag506xghssuy_pe
ddsadsgagc526xghssuys
ddsads506ighssuys
ddsadsgag506pghssuyk (1 Reply)
Discussion started by: 793589
1 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I have below type file.
abc|asd|pqr|2|2|2
asc|qwe|scf|5|4|4
Pipe location and count is dynamic and coming from a variable.
I want to change it to below files.
(chnage the first pipe to 3 pipes)
abc|||asd|pqr|2|2|2
asc|||qwe|scf|5|4|4
(chnage the second pipe to 4 pipes)... (1 Reply)
Discussion started by: swat
1 Replies
8. Shell Programming and Scripting
Hi,
I have a log file generated by a tool which has the following look :
/tmp/releases/directory/datefilename1_release_date.zip
/tmp/releases/directory/datefilename2_release_date.zip
/tmp/releases/directory/datefilename3_release_date.zip... (8 Replies)
Discussion started by: bhaskar_m
8 Replies
9. Shell Programming and Scripting
I have tried
sed '/6/a text_to_inserted' file > newfile
but this inserts test_to_insert at random places in file and i want it in specific location, which is line 6.
can anyone help.... (6 Replies)
Discussion started by: phenom
6 Replies
10. Shell Programming and Scripting
Script 1
Pre-requisites
Create a file with x amount of lines in it, the content of your choice.
Write a script that takes two arguments. The first being a line of text, the second being your newly created file. The script should take the first argument and insert it into the very top (the... (3 Replies)
Discussion started by: ali hussain
3 Replies