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 302246793 by Linux-fueled on Tuesday 14th of October 2008 11:37:21 AM
Old 10-14-2008
Insert two strings at the beginning and at the end of each line of a file

Hi, excuse me for my poor english.
My problem is that:

I have a File
i want to add to each line of that file two strings: one at the beginning of the line, one at the ending.

string1="abcd"
string2="efgh"

i want $string1 content $string2 for each line.
Is that possible?
 

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
xgettext(1)						      General Commands Manual						       xgettext(1)

NAME
xgettext - conditionally extract strings from C programs SYNOPSIS
xgettext -d [ cmnopvhP ] [ -odirectory-prefix ] [ -xexclude-list ] [ filename ... ] xgettext [ -amopvhP ] [ -xexclude-list ] [ filename ... ] DESCRIPTION
xgettext is used to automate the creation of portable message files. A portable message file contains copies of "C" strings that are found in "C" source code in filename. When the -d option is specified, xgettext places the extracted strings in the file name.po. name is either the domain specified in a dgettext call, or messages.po for strings extracted from gettext and textdomain calls. If the -d flag is not specified, xgettext places all the strings in messages.po. The portable message file can be used as input to the msgfmt(1) utility, which will produce a binary form of the message file than can be used at application run-time. OPTIONS
-a Extract ALL strings, not just those found in gettext, dgettext, and textdomain calls. -cflag Comments beginning with flag filename on the first line of the comment are added to file filename as # delimited comments. -d Produce duplicates. Does not sort output when writing the portable message file and will not overwrite existing output files. Places output from each domain specified in a dgettext call into a separate file named for the domain, ie. name.po -cflag Comments beginning with flag filename on the first line of the comment are added to file filename as # delimited comments. -mstring Causes xgettext to fill in the msgstr line of the portable message files it produces. xgettext uses the corresponding msgid string extracted from the "C" file, appending string. Useful for debugging purposes. -n Add # delimited line number comments to output file indicating the line number in the source file where each extracted string is encountered. -ofilename rename the default output file from messages.po to filename. -ppathname Specify the directory where the output files will be placed. This option overrides the current working directory. -xfilename Specify a file that contains a list of strings that are not be extracted from the input files. Each string to be excluded must appear on a line by itself in the file filename. -P include strings in pre-processor statements. -v Verbose mode. -h Print a help message on standard output. FILES
messages.po is always created, but may be empty. SEE ALSO
msgfmt(1), xstr(1), gettext, dgettext, textdomain(3). 14 Sep 1990 xgettext(1)
All times are GMT -4. The time now is 11:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy