Hi, with sed you can try:
You can add the leading tabs if you need them, but in the sample there were none so I left them out...
The part in red is a subexpression in escaped parentheses plus the back references to it in the replacement part...
This User Gave Thanks to Scrutinizer For This Post:
Greetings,
I have a file: hostnames.txt which has -
# cat hostnames.txt
machine1
machine2
I need the output to be saved to a variable as:
HOSTNAMELIST=machine1,machine2
Please advise.
Thanks,
Chiru (3 Replies)
Hi,
Is there a way to use cp in such a way that when a file is copied to a destination, the required destination folders are automatically created with the proper permissions, and the resulting copied file has the same attributes as the original. For example if I copied... (1 Reply)
Hi Guys
I need to have a shell script which reads a log file and insert a part of each line into the database. Some sample lines in the file are as below.
20091112091359 MED_RQACK : user_data=60173054304,100232120,20091112091359,;ask_status=0;ask_reason=OK;msg_id=20091112091319... (5 Replies)
Hello,
I'm wondering where I could go to learn how to edit file sections that cross multiple lines. I'm wanting to write scripts that will add Gnome menu entries for all users on a system for scripts I write, etc. I can search an replace simple examples with sed, but this seems more complex.
... (8 Replies)
Hi Forum.
I've tried to search online for a solution but I cannot seem to find one.
Hopefully, someone here can help me out. I would appreciate it.
Input file abc.txt:
$InputFile_Borrower=CMTSLST\EDW_COMMERCIAL_MTGE_BORROWER_dat.lst... (14 Replies)
Greetings,
I am using tcsh to write a script that will replace the numbers in a file with a single number, the caveat is that this file has blank lines which are necessary for another step down the line so I need to preserve the blank lines. I have tried sed and awk but both will collapse the... (1 Reply)
Hi all,
I need to write an automated bash shell script which performs such operations:
1. Grep the header of everyline with the initial of "T" in "FILE_A"
2. Perform a for loop,
Count the numbers of comma in the line of code,
if (no. of comma < 17)
ADD the comma until 17;
... (2 Replies)
Hi,
I lack the utter fundamentals on how to craft an awk script.
I have hundreds of text files that were mangled by .doc format so all the lines are broken up so I need to join all of the lines of text into a single line. Normally I use vim command "ggVGJ" to join all lines but with so many... (3 Replies)
Hi
I have a file with the following structure
"VATTENFALL GLOBAL" "Vattenfall Tray"
"BARCLAYS BANK LONDON" "Capula"
"P1 AGEAS GLOBAL COMPANY" "AAC - Optiver"
The requirement is like this
1) Take 2 input... (16 Replies)
Hi,
I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this:
Name =A
xxxxxx
yyyyyy
zzzzzz
aaaaaa
bbbbbb
Value = 57
This is necessary because in a file there are written more lines which... (6 Replies)
Discussion started by: wenclu
6 Replies
LEARN ABOUT DEBIAN
plan9-fmt
FMT(1) General Commands Manual FMT(1)NAME
fmt, htmlfmt - simple text formatters
SYNOPSIS
fmt [ option ... ] [ file ... ]
htmlfmt [ -a ] [ -c charset ] [ -u url ] [ file ... ]
DESCRIPTION
Fmt copies the given files (standard input by default) to its standard output, filling and indenting lines. The options are
-l n Output line length is n, including indent (default 70).
-w n A synonym for -l.
-i n Indent n spaces (default 0).
-j Do not join short lines: only fold long lines.
Empty lines and initial white space in input lines are preserved. Empty lines are inserted between input files.
Fmt is idempotent: it leaves already formatted text unchanged.
Htmlfmt performs a similar service, but accepts as input text formatted with HTML tags. It accepts fmt's -l and -w flags and also:
-a Normally htmlfmt suppresses the contents of form fields and anchors (URLs and image files); this flag causes it to print them, in
square brackets.
-c charset
change the default character set from iso-8859-1 to charset. This is the character set assumed if there isn't one specified by the
html itself in a <meta> directive.
-u url Use url as the base URL for the document when displaying anchors; sets -a.
SOURCE
/src/cmd/fmt.c
/src/cmd/htmlfmt
BUGS
Htmlfmt makes no attempt to render the two-dimensional geometry of tables; it just treats the table entries as plain, to-be-formatted text.
FMT(1)