11-26-2003
Q1:
Example1:
cat testfile
111 222 333 444
aaa bbb ccc ddd
111 222 333 444
In vi mode, step to remove first word.
press 'Esc'
: prompt appear
then type
%s/.[^ ]* *//
"%" is represented to whole document
Example2:
cat testfile
111 222 333 444
aaa bbb ccc ddd
111 222 333 444
In vi, step to remove lines selectively
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
On my system I use Escape "k" to go back in commands. I read on tutorials that it is ctrl p, but that does not work on my system.
Anyone know what the command to go foward is? (6 Replies)
Discussion started by: dereckbc
6 Replies
2. Shell Programming and Scripting
Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts..
I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies
3. Shell Programming and Scripting
Hi All,
I have done some looking at other threads but haven't found quite what I am looking for. I am a newbie to scripting and haven't got to where I want to you but here is my basic question. I have a script to copy a file and send it to another file with a date and time stamp. What I want to... (4 Replies)
Discussion started by: falcondown01
4 Replies
4. UNIX for Dummies Questions & Answers
I have:
aa01
aa02
aa03
aa04
ab01
ab02
ab03
ab04
I would like each record printed 5 times:
aa01
aa01
aa01
aa01
aa01
aa02
aa02 (6 Replies)
Discussion started by: kenneth.mcbride
6 Replies
5. Shell Programming and Scripting
Hello,
Does getopts have some way of handling the use of an option that requires a parameter more than once on the command line.
e.g. mycmd -a john -a jane
I came up with a solution using arrays (shown below), but wonder if getopts has some other way of handling it. Other solutions... (2 Replies)
Discussion started by: CarlosNC
2 Replies
6. Shell Programming and Scripting
I have a file like this
2011-10-10 10:46:00,1-1-13-1-1,151510,ALCLA0A84D2C
2011-10-10 10:46:00,1-1-13-1-1,151520,65537
2011-10-10 10:46:00,1-1-13-1-1,151515,46932
2011-10-10 10:46:00,1-1-13-1-1,151521,32769
2011-10-10 10:46:00,1-1-13-1-1,151522,32769
2011-10-10... (4 Replies)
Discussion started by: LavanyaP
4 Replies
7. Shell Programming and Scripting
How do i write a loop ping to see if it get timeout or hang ? it should loop every 30 second to ping a server ?
ping -c 5 -t 15 www.google.com
if ]; then
date '+%Y-%m-%d %H:%M:%S Connection Unavailable' >> /home/sabercats/checkconnection.log
else
date '+%Y-%m-%d %H:%M:%S Connection... (3 Replies)
Discussion started by: sabercats
3 Replies
8. Shell Programming and Scripting
Hey,
I've created following script:
var1=test1
setA=testA
if
...
touch $setA/$var1
...
fi
I would like now the repeat the command touch (in this example) for different variables.
So below, the varX should run 3 times (var1, var2, var4). Var3 is skipped in this example... (4 Replies)
Discussion started by: brononius
4 Replies
9. Programming
I came across a site to learn java and they give you practice problems to do. I was wondering if anyone can help me with this since I am totally new to Java. Here is the first problem:
Write a program that will read in a name from the command line and write it out 100 times.
Thank you for any... (10 Replies)
Discussion started by: totoro125
10 Replies
10. UNIX for Dummies Questions & Answers
Assume i have typed 4 commands in the past like
vi `ls -t |head -n 1`
tail -2 test.txt
ls -lrt | grep "/etc/profile.d"
pwd
Now if i type r p it should execute the command "pwd" likewise r t should execute tail -2 test.txt.
Note: esc k and using up arrow and down arrow will get this work... (3 Replies)
Discussion started by: Ramanareddygv
3 Replies