Sponsored Content
Full Discussion: add a word every other line
Top Forums Shell Programming and Scripting add a word every other line Post 302577969 by CarloM on Wednesday 30th of November 2011 11:05:13 AM
Old 11-30-2011
A blank line, or fixed/variable text? To be added above all input lines, or every other input line?

If it's blank or fixed on every line, you could do something like:
Code:
awk '{printf "\n"; print}' infile.txt

or
Code:
sed 's/^/\n/g' infile.txt

This User Gave Thanks to CarloM For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add a word at the end of each line in a file

Hi I want to read a flat file and add a word/value at the end of each line in the file and store the output in a temporary file. How can i do this? Plz help me with this. Regards, Saurabh (6 Replies)
Discussion started by: bhalotias
6 Replies

2. Shell Programming and Scripting

Want to add a word in front a of each line of a file

Hi, Can anybody help me how to add a word in front of a line in a file.Actually it is bit tricky to add a word. i will give a sample for this: Input : 1110001 ABC DEF 1110001 EFG HIJ 1110001 KLM NOP 1110002 QRS RST 1110002 UVW XYZ Output: %HD% 1110001 ABC DEF %DT% 1110001 EFG HIJ... (4 Replies)
Discussion started by: apjneeraj
4 Replies

3. Shell Programming and Scripting

Print word 1 in line 1 and word 2 in line 2 if it matches a pattern

i have a file in this pattern MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1... (7 Replies)
Discussion started by: bangaram
7 Replies

4. Shell Programming and Scripting

how to Add word at specific location in line

eg . i have file x.txt contains : java coding , shell scriptting etc... now i want to add "is langauge" after word java. output should be java is langauge coding , shell scriptting etc... any idea how to use shell script to do it ? (10 Replies)
Discussion started by: crackthehit007
10 Replies

5. UNIX for Dummies Questions & Answers

Script to add text before the first word on a line in a textfile.

How can i make a script to add text before the first word on a line in a textfile : Example: Old line: is my place New line: this is my place Please use and tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. (3 Replies)
Discussion started by: mjanssen
3 Replies

6. Shell Programming and Scripting

how to add single digit in front of the word and line in the file.

Hi , how to add the single digit to front of the word and front of the lines in the one file with compare pattern file and get digit. like example pattern file pattern.txt pattern num bala 2 raja 3 muthu 4 File Name: chennai.dat muthu is good boy raja is bad boy selvam in super... (6 Replies)
Discussion started by: krbala1985
6 Replies

7. UNIX for Dummies Questions & Answers

Add word/value at the beginning of each line in a file

how to add value/word at the beginning of each line in a file ? i have file number.txt and the output is below 1000 1001 1002 1003 1004 i want to add 000 at the beginning of each line, desire output is below 0001000 0001001 0001002 0001003 0001004 and so on please advise how... (5 Replies)
Discussion started by: jason6247
5 Replies

8. Shell Programming and Scripting

Read a File line by line and split into array word by word

Hi All, Hope you guys had a wonderful weekend I have a scenario where in which I have to read a file line by line and check for few words before redirecting to a file I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies

9. Shell Programming and Scripting

Find word in a line and output in which line the word occurs / no. of times it occurred

I have a file: file.txt, which contains the following data in it. This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt My name is not Karl, my name is Karl Joey What is your name? Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

10. Shell Programming and Scripting

How to add a character after the first word/space on each line?

Hi:) I have a large file ( couple thousand lines ) and I'm trying to add a character after the first word/space on each line. eg: First line of text Second line of text Third line of text Fourth line of text Fifth line of text I'd like to accomplish: First - line of text Second... (8 Replies)
Discussion started by: martinsmith
8 Replies
FvwmSaveDesk(1) 						   Fvwm Modules 						   FvwmSaveDesk(1)

NAME
FvwmSaveDesk - another fvwm desktop-layout saving module SYNOPSIS
FvwmSaveDesk is spawned by fvwm, so no command line invocation will work. DESCRIPTION
When called, this module will attempt to save your current desktop layout as a definition of extra lines for the function InitFunction into the file .fvwm2desk in your home directory. As explain in the other documentation, this function is called at startup of fvwm. You have to include this file in .fvwm2rc after the definition of the Function Initfunction. You can do this by using the module FvwmM4 or FvwmCpp. Your applications must supply certain hints to the X window system. Emacs and Netscape, for example, does not, so FvwmSaveDesk can't get any information from it. Also, FvwmSaveDesk assumes that certain command line options are globally accepted by applications, which may not be the case. SETUP USING FVWMM4 MODULE The M4 Macro processor substitutes its macros even in the middle of a word. Because of that you may have problems with predefined macros such as include or define. To avoid this the GNU M4 has an extra option to prefix all builtins with 'm4_'. FvwmM4 can be called with option -m4-prefix and then will provide the option -P to M4. I personally use the FvwmM4 module this way. fvwm -cmd "FvwmM4 -m4-prefix -m4opt -I$HOME $HOME/.fvwm2rc" Simply add the following line to the end of .fvwm2rc: m4_include(`.fvwm2desk') . SETUP USING FVWMCPP MODULE
With the FvwmCpp you may have the problem that the preprocessor directives starts with the comment character '#' and will complain about unknown directives, if you have comments in your .fvwm2rc. fvwm -cmd "FvwmCpp -C-I$HOME $HOME/.fvwm2rc" Simply add the following line to the end of .fvwm2rc: #include ".fvwm2desk" INVOCATION
FvwmSaveDesk can be invoked by adding it to a menu or binding it to a mouse button or key stroke in the .fvwm2rc file. Fvwm will search directory specified in the ModulePath configuration option to locate FvwmSaveDesk. To insert it to a menu, add the line + "Save Desktop" Module FvwmSaveDesk to the menu definition. I thing binding it to a mouse button is not very useful, but you can do that, by adding for example this line. Mouse 3 R CS Module FvwmSaveDesk Than FvwmSaveDesk will be called if you hit the right mouse button on the root window while holding the shift and control button down. You can bind FvwmSaveDesk to a function key F10 for example you have to insert the following line: Key F10 A Module FvwmSaveDesk I personally add it as a Button to the module FvwmButtons: *FvwmButtons SaveDesc desk.xpm Module FvwmSaveDesk AUTHOR
Carsten Paeth (calle@calle.in-berlin.de) 3rd Berkeley Distribution 09 May 2010 (2.5.30) FvwmSaveDesk(1)
All times are GMT -4. The time now is 04:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy