Sponsored Content
Top Forums UNIX for Dummies Questions & Answers using sed to append text to the end of each line Post 302081492 by reborg on Tuesday 25th of July 2006 07:56:34 PM
Old 07-25-2006
if think the poster is asking for something along the lines of:

Code:
awk 'awk 'NR == 1 { fields = NF} { printf "%s", $0 ; for ( i = NF +1; i <=fields ) { printf " \t"}; printf "\n"}' file > newfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Append text at end of the first line in a file

Hi I need to append some text @ end of the first line in a file. like myfile.txt list = a,b,c list.a=some.. I give the arg "d" . now it append at end of first line list=a,b,c,d list.a=some... Please help me out this (7 Replies)
Discussion started by: catgovind
7 Replies

2. Shell Programming and Scripting

Sed : identify a pattern and append a word at the end of a line

Hello to all, On aix, I want to identify a term on a line in a file and then add a word at the end of the line identified. I do not want the word to be added when the line contains the symbol "#". I use the following command, but it deletes the term identified then adds the word. #sed... (4 Replies)
Discussion started by: dantares
4 Replies

3. Shell Programming and Scripting

Append text to end of line on all lines

Hi, I've spent some time researching for this but can't seem to find a solution. I have a file like this 1234|Test|20101111|18:00|19:00There will be multiple lines in the file with the same kind of format. For every line I need to make it this 1234|Test|20101111|18:00|19:00||create... (5 Replies)
Discussion started by: giles.cardew
5 Replies

4. Shell Programming and Scripting

append text from file1 to the end of each line in file2

hi; my file2.txt:portname=1;list=10.11;l- portname=2;list=10.12;l- portname=3;list=10.13;l- ... my file1.txt:;"{'sector=%27'}"\&> so; i want to see:portname=1;list=10.11;l-;"{'sector=%27'}"\&> portname=2;list=10.12;l-;"{'sector=%27'}"\&> portname=3;list=10.13;l-;"{'sector=%27'}"\&>... (4 Replies)
Discussion started by: gc_sw
4 Replies

5. Shell Programming and Scripting

Append text to end of every line

I've scoured the internet with mixed results. As an amateur I turn to the great minds here. I have a text file of 80 or so lines. I want to add ".pdf" to the end of each line. (For now that's it) Most of the internet points toward using "sed". I don't know coding but can figure things out... (4 Replies)
Discussion started by: spacebase
4 Replies

6. Shell Programming and Scripting

find a certain line and append text to the end of the line

After I create printer queues in AIX, I have to append a filter file location within that printers custom file. within lets say test_queue.txt I need to find the row that starts with :699 and then I need to append on the end the string /usr/local/bin/k_portrait.sh. Now I've gotten the sed... (2 Replies)
Discussion started by: peachclift
2 Replies

7. Shell Programming and Scripting

Append text to line if begins with pattern1 AND does not end with pattern2

Hello, I'm looking for sed solution to change ... <li>keyword</li> <li>keyword <li>keyword</li> <li>keyword <li>keyword</li> ... to ... <li>keyword</li> <li>keyword</li> <li>keyword</li> <li>keyword</li> <li>keyword</li> ... I.e., if lines beginning with <li> do not end with... (3 Replies)
Discussion started by: pioavi
3 Replies

8. Shell Programming and Scripting

SED and Solaris Append line to the end of File does not work

Hello, I have to add a new line at the end of a File on Solaris-System: I think my script should be right, because I evaluated it to other threads. However the script does not what I am expected it should do. My file might look like this: Line1 Line2 Line3 And my script could... (7 Replies)
Discussion started by: Timo_HR
7 Replies

9. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

10. Shell Programming and Scripting

sed command to append word at end of line

hello Team, I am looking for sed command or script which will append word at end of line. for example. I want to validate particular filesystem with mount |<filesystem name> command. if nodev parameter is not there then it should add in the fstab file with receptive to the filesystem. # mount... (8 Replies)
Discussion started by: ghpradeep
8 Replies
SNIFFIT(5)							File Formats Manual							SNIFFIT(5)

NAME
sniffit - configuration file for sniffit (name arbirtary) DESCRIPTION
This page describes the format for the config file for sniffit (see sniffit(8) ). This file allows you to specify in great detail witch packets should be processed by sniffit. This file also controls (or will control) some functions for the continuous logging ('-L' option). A sniffit config file might look like (Be sure to end it with a BLANK line): # Sniffit Sample Config file -- Brecht Claerhout logfile /var/log/sniffit.today.log # First select all packets! select both mhosts 1 select both mhosts 2 # Now deselect all packets from/to those damn 'surfers' deselect both port 80 deselect both port 8001 This file will tell sniffit to process all packets on the subnet except those FROM/TO ports 80 and 8001 (thus we don't want logs of those mass WWW connections witch turn our logs unreadable). GLOBAL FORMAT
The file consists of lines, lines are formed by fields, fields are separated with SPACES (NO TABS). Unix comment lines (starting with '#' are allowed). So this gives us: <field1> <field2> <field3> <field4> <field5> FIELD FORMAT
<field1> select - Sniffit will look for packets that match the following description (other fields) deselect - Sniffit will ignore packets that match the description logfile - change the logfile name to <field2> instead of the default 'sniffit.log' <field2> from - Packets FROM the host matching the following desc. are considered. to - similar, Packets TO the.... both - similar, Packets FROM or TO the.... a filename - as an argument of 'logfile' in <field1> <field3> host - The (de)selection criteria involves a hostname. port - similar, ... a portnumber mhosts - The (de)selection criteria involves multiple-hosts, like with the wildcars in 0.3.0, but without the 'x' <field4> Either a hostname, a portnumber, a service name or a numbet-dot partial notation indicating multiple hosts depending on <field3> (service names like 'ftp' are resolved as the services available present on the host that runs Sniffit, and translated into a port nr) <field5> A portnumber, if <field3> was 'host' or 'mhosts' (optional, if not filled in, all ports are going to be (de)selected) FILE INTERPRETING
The config file is interpreted SEQUENTIAL, so watch it, don't mix lines in a file. Example: select both mhosts 100.100.12. deselect both port 80 select both host 100.100.12.2 This file will get you the packets: a) Send by hosts '100.100.12.*' b) EXCEPT the WWW packets c) BUT showing the WWW packets concerning 100.100.12.2 select both mhosts 100.100.12. select both host 100.100.12.2 deselect both port 80 Will give you the packets (probably unwanted result): a) Send by hosts '100.100.12.*' b) Send from/to 100.100.12.2 (useless line) c) deselecting all WWW packets on the subnet AUTHOR
Brecht Claerhout <coder@reptile.rug.ac.be> SEE ALSO
sniffit(8) SNIFFIT(5)
All times are GMT -4. The time now is 10:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy