04-03-2008
Quote:
Originally Posted by
Ernst
Thanks!
This command works: sed 's/.*/echo "&"/'
What if I want at the same time to add something to the end of each line.
i.e echo "unixtest=test" >> firsttest
what would the command be to add the >> firsttest to teh end of each line
What have you tried? Considering you have the basic layout there, you might want to try modifying it slightly and seeing if it works. That will earn you a lot more respect. Perhaps more importantly, you could actually learn something which will help you in the future.
ShawnMilo
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How can i add a character(#) in the beginning of every line in a .dat file (2 Replies)
Discussion started by: Cool Coder
2 Replies
2. Shell Programming and Scripting
I have a large file which reads like this:
fixed-address 192.168.6.6 {
hardware ethernet 00:22:64:5b:db:b1;
host X;
}
fixed-address 192.168.6.7 {
hardware ethernet 00:22:64:5b:db:b3;
host Y;
}
fixed-address 192.168.6.8 {
hardware ethernet 00:22:64:5b:db:b4;
host A;
}... (4 Replies)
Discussion started by: ksk
4 Replies
3. UNIX for Dummies Questions & Answers
Hi,
how could you go about removing words that begin with a certain character.
assuming that this character is '-' I currently have
echo "-hello" | sed s/-/""/
which replaces the leading dash with nothing but I want to remove the whole word, even if there are multiple words beginning... (3 Replies)
Discussion started by: skinnygav
3 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have file a.txt as below. I want to add one string root beginning of each line.
Sample file a.txt
aaa
bbb
ccc
Sample output
Root aaa
Root bbb
Root ccc
Can any one help me on this? (6 Replies)
Discussion started by: siba.s.nayak
6 Replies
5. UNIX for Dummies Questions & Answers
Greetings.
I am a UNIX newbies.
I am currently facing difficulties dealing with a large data set and I would like to ask for helps. I have a input file like this:
ak 1 AAM1
ak 2 AAM1
ak 3 AAM1
ak 11 AMM2
ak 12 AMM2
ak 13 AMM2
ak 14 AMM2
Is there any possibility for me to... (7 Replies)
Discussion started by: Amanda Low
7 Replies
6. UNIX for Dummies Questions & Answers
about 200 files with names as
11_0.pdb
11_60.pdb
12_12.pdb
14_180.pdb
are there in my library...I need to rename all of them by addinf File in front of them as:
File11_0.pdb
File11_60.pdb
File12_12.pdb
File14_180.pdb
I checked many threads but it seems i get even more confused..i... (1 Reply)
Discussion started by: kanikasharma
1 Replies
7. Shell Programming and Scripting
Hi,
I am doing something like below:
cat file1>file3and
cat file2>>file3
I wanted to check if there is a way to write a custom message(hardcoded message)something like below at the beginning of each line then PIPE delimitiation and then followed by remaining record.
cat file1... (7 Replies)
Discussion started by: Saanvi1
7 Replies
8. Shell Programming and Scripting
My file has the entries like below...
/dev/sds
/dev/sdak
/dev/sdbc
/dev/sdbu
I want to make the file like below
echo 1 > /sys/block/sds/device/rescan
echo 1 > /sys/block/sdak/device/rescan
echo 1 > /sys/block/sdbc/device/rescan
echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Discussion started by: saravanapandi
2 Replies
9. Shell Programming and Scripting
Hi all and apologies for the silly question, but I've searched and I can't get this right.
I have a list of email addresses in a file that I need to blacklist (spam). the list is quite long and I would need to script a small routine so that I can get the following for each line in the file:
db... (4 Replies)
Discussion started by: bm555
4 Replies
10. UNIX for Beginners Questions & Answers
I am trying to write a command and need to count all the words within the file which begin with the letter S
I have run this command
$ grep '^' TheAgileApproach.dat | wc -l
0
$ grep '^' TheAgileApproach.dat | wc -l
1
When I remove the wc -l I see the output as below:
$ grep '^'... (7 Replies)
Discussion started by: simpsa27
7 Replies
ECHO(1) BSD General Commands Manual ECHO(1)
NAME
echo -- write arguments to the standard output
SYNOPSIS
echo [-n] [string ...]
DESCRIPTION
The echo utility writes any specified operands, separated by single blank (' ') characters and followed by a newline ('
') character, to the
standard output.
The following option is available:
-n Do not print the trailing newline character.
The end-of-options marker -- is not recognized and written literally.
The newline may also be suppressed by appending 'c' to the end of the string, as is done by iBCS2 compatible systems. Note that the -n
option as well as the effect of 'c' are implementation-defined in IEEE Std 1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002. For porta-
bility, echo should only be used if the first argument does not start with a hyphen ('-') and does not contain any backslashes (''). If
this is not sufficient, printf(1) should be used.
Most shells provide a builtin echo command which tends to differ from this utility in the treatment of options and backslashes. Consult the
builtin(1) manual page.
EXIT STATUS
The echo utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
builtin(1), csh(1), printf(1), sh(1)
STANDARDS
The echo utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002.
BSD
November 12, 2010 BSD