Visit Our UNIX and Linux User Community

Full Discussion: Add the characters in file
Top Forums Shell Programming and Scripting Add the characters in file Post 302845633 by MadeInGermany on Thursday 22nd of August 2013 03:14:47 AM
Old 08-22-2013
In case the target file is (part of) a shell script, then consider rewriting
if [ ... ]

case $LOGNAME in

Further the case statement allows globbing like this

This User Gave Thanks to MadeInGermany For This Post:
Test Your Knowledge in Computers #322
Difficulty: Easy
HTML stands for Hypertext Markdown Language.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add few characters

Hello, I have a file with few n number of lines .I want to add any character ie comma "," in begining of each line of the file i dont know how many lines the file may contain Also, i want to add comma twice ot thrice in front of each line like 3 coulmn's. input file abc def ijk output... (7 Replies)
Discussion started by: er_aparna
7 Replies

2. Shell Programming and Scripting

Add spaces between Characters

I need to add spaces in between characters in a string variable. Is there a shortcut? I know you can remove the spaces with sed, but does sed have a way to add them? Example: I have: DATA01 I want it to be: D A T A 0 1 What I have done so far is to create a function... (4 Replies)
Discussion started by: heyindy06
4 Replies

3. Shell Programming and Scripting

add a hyphen every 2 characters of every line

I have a text file like this with hundreds of lines: >cat file1.txt 1027123000 1027124000 1127125000 1128140000 1228143000 > all lines are very similar and have exactly 10 digits. I want to separate the digits by twodigit and so, > 10-27-12-30-00 10-27-12-40-00... (7 Replies)
Discussion started by: ajp7701
7 Replies

4. Shell Programming and Scripting

Add characters at specific position in file

Hello I want to add some value at the specific position. My file has data like Hello Welcome to UNIX Forums Need Assistance I want to add some value at the end but at same character position for all lines. I want my output file to have data like : Here '_' represents blanks.... (3 Replies)
Discussion started by: dashing201
3 Replies

5. Shell Programming and Scripting

replace and add characters in filename

I have files named like ABAB09s099E1AAV1.pdf and ABAB09s099E2AAV1.pdf in a directory. I need to add _Lop in the end of the name, like ABAB09s099E1AAV1_Lop.pdf for all files. For files with E2 in the name I also have to replace 99 with 88 in the filename, that would be ABAB09s088E2AAV1_Lop.pdf ... (3 Replies)
Discussion started by: hakkar
3 Replies

6. UNIX for Dummies Questions & Answers

Line & File Manipulation - add spaces between characters

Is there an awk, sed, vi or any line command that adds Field Separators (default spaces) to each line in a file? $cat RegionalData 12FC2525MZLP8266900216 12FC2525MZLP8266900216 12FC2525NBLP8276900216 12FC2525NBLP8276900216 Desired results: 1 2 F C 2525 MZ LP 826 690 02 16 1 2 F C... (2 Replies)
Discussion started by: MS75001
2 Replies

7. Shell Programming and Scripting

cut add characters

i have following fixed width text(also has a delimiter) id;name;age;comments1;comments2;title;date to get output as id;name;age;;;title;date (remove comments but keep the delimiter in between) i use cut -c1-12,22,32- suppose if i want to insert another ; somewhere like ... (3 Replies)
Discussion started by: petergemeni
3 Replies

8. Shell Programming and Scripting

Count characters in a csv file and add an word.

Hello, I want to add a sentence to "post column" those who are only less than 30 characters.Thank you very much for your help. "category","title","post" "Z","Zoo","test 54325 test 45363mc." "Z","Zen","rs2w3rsj 2d342dg 2d3s4f23 d23423s23h 2s34s2423g ds232d34 2342." "Z","Zet","test4444... (3 Replies)
Discussion started by: hoo
3 Replies

9. Shell Programming and Scripting

Grep to remove and add specified characters

I have the following type of 2 column file: motility - role - supplementation - age b ancestry b purity b recommendation b serenity b unease b carving f expansion f I would like to print only certain sections of the file depending on the value of the second column. For instance,... (6 Replies)
Discussion started by: owwow14
6 Replies

10. Shell Programming and Scripting

Using awk to add length of matching characters between field in file

The awk below produces the current output, which will add +1 to $3. However, I am trying to add the length of the matching characters between $5 and $6 to $3. I have tried using sub as a variable to store the length but am not able to do so correctly. I added comments to each line and the... (4 Replies)
Discussion started by: cmccabe
4 Replies
FBB::mlm(3bobcat)                                             OFoldStream manipulator                                            FBB::mlm(3bobcat)

FBB::mlm - Manipulator modifying left margins of OFoldStream objects SYNOPSIS
#include <bobcat/ofoldstream> or #include <bobcat/ofoldstreambuf> Linking option: -lbobcat DESCRIPTION
The mlm class implements a manipulator that can be inserted into OFoldStream objects to modify the stream's left margin by a requested amount. The request cannot result in a negative left margin value. If a negative left margin would be the arithmetic result of the request then left margin 0 will silently be used. Depending on the tab-setting of the OFoldStream the inserted value represents the number of blank space characters or the number of tab-characters that will be added to the left margin. The request will be processed at the next newline character or std::flush or std::endl manipulator that is inserted into the stream. If a line is still empty once an mlm object and a flush manipulator are inserted into the stream then the new left margin will be effective at the next word inserted into that line (cf., the example section below) A bad_cast exception is thrown when the manipulator is inserted into an ostream that is not using a OFoldStreambuf buffer. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
o mlm(int addValue): The standard copy constructor is available. MEMBER FUNCTIONS
There are no public or protected member functions in this class. EXAMPLE
#include <iostream> #include <bobcat/ofoldstream> using namespace std; using namespace FBB; int main() { OFoldStream out(cout, 0, 80); out << "hello world (left margin is 0)" << mlm(4) << " " "this uses a 4 character wide left margin " << mlm(-10) << flush << "left margin -6 changed to 0, active on this line "; return 0; } FILES
bobcat/mlm - defines the class interface SEE ALSO
bobcat(7), manipulators(3bobcat), lm(3bobcat), ofoldstream(3bobcat) BUGS
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken ( libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::mlm(3bobcat)

Featured Tech Videos

All times are GMT -4. The time now is 01:57 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy