Sponsored Content
Top Forums Shell Programming and Scripting Insert two strings at the beginning and at the end of each line of a file Post 302246809 by Linux-fueled on Tuesday 14th of October 2008 12:26:09 PM
Old 10-14-2008
Ignore me, i've found how to remove spaces by myself.

Thanks again Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cat a file from end to beginning

Is there an option, for cat, head, tail, or is there any way, to display a file from last line to first? For example, my file looks like this: aaaa bbbb cccc eeee and I would like to print or display it like this: eeee cccc bbbb aaaa thanks (5 Replies)
Discussion started by: jpprial
5 Replies

2. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

How can I specify special meaning characters like ^ or $ inside a regex range. e.g Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character. I tried the following but it does not work: sed 's/\(\)/<do something here>/g' file1 ... (3 Replies)
Discussion started by: jawsnnn
3 Replies

3. Shell Programming and Scripting

Need to insert text(constant) at the beginning of file

I am very new to scripting and I know this request is simple but I am having no luck with it. I have a file a.dat with the following data in it. aa bb cc dd I need to run a script that will take each line of a.dat and put dsjc/ubin/ in front of each record, so the output looks like ... (2 Replies)
Discussion started by: jclanc8
2 Replies

4. Shell Programming and Scripting

trying to add text to beginning and end of each line

Well here goes: I tried to write a batch file that adds a specific fixed text to each line of an already existing text file. for the adding text infront of each line I tried this: for /F "delims=" %%j in (list.txt) do echo.STARTTEXT\%%j >> list.txt for adding text after each line I... (0 Replies)
Discussion started by: pasc
0 Replies

5. Shell Programming and Scripting

SED - insert space at the beginning of line and multi replace command

hi I am trying to use SED to replace the line matching a pattern using the command sed 'pattern c\ new line ' <file1 >file 2 I got two questions 1. how do I insert a blank space at the beginning of new line? 2. how do I use this command to execute multiple command using the -e... (5 Replies)
Discussion started by: piynik
5 Replies

6. UNIX for Dummies Questions & Answers

vim copy line and paste at the beginning, middle, and end of another line

How would you do vim copy line and paste at the beginning, middle, and end of another line. I know yy copies the whole line and p pastes the whole line, but on its own separate line. Sometimes I would like to copy a line to the beginning, middle, or end of another line. I would think this would be... (3 Replies)
Discussion started by: cokedude
3 Replies

7. Shell Programming and Scripting

Insert output from a file to beginning of line with sed

Hi I've been trying to search but couldn't quite get the answer I was looking for. I have a a file that's like this Time, 9/1/12 0:00, 1033 0:10, 1044 ... 23:50, 1050 How do I make it so the file will be like this? 9/1/12, 0:00, 1033 9/1/12, 0:10, 1044 ... 9/1/12, 23:50, 1050 I... (4 Replies)
Discussion started by: diesel88
4 Replies

8. UNIX for Dummies Questions & Answers

sed - Add a variable line to the end of a block beginning with a regex

Hi, Need some help with sed. I have a file that has sections : e.g. a=blah b=blah d=blah e=blah There's many sections in the file. (1 Reply)
Discussion started by: andyatit
1 Replies

9. Shell Programming and Scripting

Add new line at beginning and end of a file

Hi, I have a specific requirement to add text at the beginning and end of a plain text file. I tried to use "sed" with '1i' and '$a' flags but these required two separate "sed" commands separated with "|". I am looking for some command/option to join these two in single command parameter. ... (6 Replies)
Discussion started by: bhupinder08
6 Replies

10. Shell Programming and Scripting

Insert text at the beginning of every even number line

i am trying to insert text at the beginning of every even number line with awk i can do it with odd number lines with this command awk 'NR%2{$0="some text "$0}1' filehow can i edit this command thanks (5 Replies)
Discussion started by: bob123
5 Replies
SDIFF(1)						    BSD General Commands Manual 						  SDIFF(1)

NAME
sdiff -- side-by-side diff SYNOPSIS
sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2 DESCRIPTION
sdiff displays two files side by side, with any differences between the two highlighted as follows: new lines are marked with '>'; deleted lines are marked with '<'; and changed lines are marked with '|'. sdiff can also be used to interactively merge two files, prompting at each set of differences. See the -o option for an explanation. The options are: -l Only print the left column for identical lines. -o outfile Interactively merge file1 and file2 into outfile. In this mode, the user is prompted for each set of differences. See EDITOR and VISUAL, below, for details of which editor, if any, is invoked. The commands are as follows: l Choose left set of diffs. r Choose right set of diffs. s Silent mode - identical lines are not printed. v Verbose mode - identical lines are printed. e Start editing an empty file, which will be merged into outfile upon exiting the editor. e l Start editing file with left set of diffs. e r Start editing file with right set of diffs. e b Start editing file with both sets of diffs. q Quit sdiff. -s Skip identical lines. -w width Print a maximum of width characters on each line. The default is 130 characters. Options passed to diff(1) are: -a Treat file1 and file2 as text files. -b Ignore trailing blank spaces. -d Minimize diff size. -I regexp Ignore line changes matching regexp. All lines in the change must match regexp for the change to be ignored. -i Do a case-insensitive comparison. -t Expand tabs to spaces. -W Ignore all spaces (the -w flag is passed to diff(1)). ENVIRONMENT
EDITOR, VISUAL Specifies an editor to use with the -o option. If both EDITOR and VISUAL are set, VISUAL takes precedence. If neither EDITOR nor VISUAL are set, the default is vi(1). TMPDIR Specifies a directory for temporary files to be created. The default is /tmp. SEE ALSO
diff(1), diff3(1), vi(1), re_format(7) AUTHORS
sdiff was written from scratch for the public domain by Ray Lai <ray@cyth.net>. CAVEATS
Although undocumented, sdiff supports all options supported by GNU sdiff. Some options require GNU diff. Tabs are treated as anywhere from one to eight characters wide, depending on the current column. Terminals that treat tabs as eight charac- ters wide will look best. BUGS
sdiff may not work with binary data. BSD
February 21, 2007 BSD
All times are GMT -4. The time now is 05:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy