Pls Ans this question ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Pls Ans this question ...
# 1  
Old 07-17-2006
Pls Ans this question ...

In the Text file ex sample.txt

cat sample.txt

morning
evening
night
bye

__________________
i want add text "Good " i front of all the words .
u have to use one vi command only
or
u can write script also

o/p should be like this

cat sample.txt
Good morning
Good evening
Good night
Good bye

___________
# 2  
Old 07-17-2006
Show us what you have tried so far ? Maybe we could help you out better.
# 3  
Old 07-17-2006
Code:
awk '{printf "%s%s\n", "Good ", $0}' sample.txt

# 4  
Old 07-17-2006
Another way to t do the work :
Code:
sed 's/^/Good /' sample.txt

# 5  
Old 07-17-2006
Thanks for replay ...

pls let me know . Whether we can do in VI Editor or not ..
# 6  
Old 07-17-2006
in vi editor

Code:
:%s/^/Good/g

Jean-Pierre.
# 7  
Old 07-17-2006
also in vi(m) type
g g C+v M+g M+i, type 'Good ', then Esc
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cannot get the correct ans. Using awk in taking average

Hi all, I think so I’m getting the result is wrong, while using following awk commend, colval=$(awk 'FNR>1 && NR==FNR{a=$4;next;} FNR>1 {a+=$4; print $2"\t"a/3}' filename_f.tsv filename_f2.tsv filename_f3.tsv) echo $colval >> Result.tsv it’s doing the condition 2 times, first result... (5 Replies)
Discussion started by: Shenbaga.d
5 Replies

2. UNIX for Advanced & Expert Users

UNIX ques!! Ans URGENT!!

hello guys!! need 1 favour from u all.. Can u jst tell me the answers for these ques?? 1. ls - l _____ : command to return all files that end with single digit and those with TXT extension 2. ls -l report* _______ : command to return all files that start with the word RPT except those with LOG... (1 Reply)
Discussion started by: Gan_7
1 Replies

3. Shell Programming and Scripting

comparing ans compute mean two fields in different files

HI I'm gaving trouble to do that script in awk. I would like to compute the mean of two colomns from two diffent files just like that file 1 4 1 5 2 6 3 file 2 1 1 2 2 3 3 (3 Replies)
Discussion started by: yassinegoth
3 Replies

4. Shell Programming and Scripting

pls help kinda difficult question for a beginner

1. Create a directory script (project_dir.sh) · Write a script in your home directory to create a subdirectory called “PROJECT<99>” within your home directory on the Ubantu/Linux server. <99> is your project number (e.g. 01,02,03, ... 15). · The script must test whether... (1 Reply)
Discussion started by: bugenhagen_
1 Replies

5. Shell Programming and Scripting

Different way to connect to database ans execute sql query

Hi Friends, I am using AIX version and sqlplus to connect to database while writing a shell script. I have implemented three ways to connect to database : 1) sqlplus -s <USERNAME>/<PASSWORD> <<! @<SQL FILE TO EXECUTE> exit ! 2) sqlplus -s <USERNAME>/<PASSWORD> <<! -----sql statemenets... (6 Replies)
Discussion started by: gauravgarg
6 Replies

6. Shell Programming and Scripting

We need a script that invokes the sql query every 14 days ans send email

Hi, We need a script that invokes the sql query every 14 days ans send email (0 Replies)
Discussion started by: bujjisveeru
0 Replies

7. Programming

Interview question ...pls help!!

You have a compiled C binary which you can execute and run, but you suspect it may be hanging. You do not have the source. What can you do to gather information and/or clues about what the program is doing? Any help will be really appreciated!! (1 Reply)
Discussion started by: choco4202002
1 Replies

8. UNIX for Advanced & Expert Users

diff between xargs ls ans ls execution

hi, could any one tell me what is diff between #ls and #xrgs ls (1 Reply)
Discussion started by: useless79
1 Replies

9. UNIX for Dummies Questions & Answers

telnet ans ssh

Hi all, I need few information as follows: 1. I am acessing one the machine uismg putty at port no 12023 using telnet service. My question is i heard by defalult the port for telnet is 23. Why it is 12023 in my case. Also where can i change it. 2. i install new debian server. And then... (1 Reply)
Discussion started by: gauri
1 Replies
Login or Register to Ask a Question