You're making it too hard. Try something like:
With the input you specified in your last post, this script produces:
You specified bash; this script will also work with any other POSIX conforming shell.
Hi,
I'm trying to write a script that reads filenames from a file and use these filenames in a loop. The filenames are all on one line and the problem is that these filenames have wildcards like * and braces like in them.
Right now what I'm doing is something like this:
echo "reading from... (0 Replies)
Hi
Im MZ.... please help me with my requirements.....
Requirement: I have a text file named information.txt which contains information about Oracle Instances, I want to fetch data's from that text file and want to display an output using shell script.
Explanation : i.e. when I execute that... (0 Replies)
i get a name from user first name : last name, in this format. Now i am saving this to a file. what i want is, I do not want to save any name if I already have one entry o that same name..what should i do
for example
user give robert fernandez
this will save in file as robert:fernandez.
if... (5 Replies)
Hi All,
I am trying to read a .csv file which has some 6 columns.
Eg: samp.csv
one, two, three, four
six, seven, eight, nine
I used the following code,
for line in `cat samp.csv`
do
echo "$line"
done
It displays every comma seperated values in each line like,
one,... (1 Reply)
I have a file that has four values on each line and I'd like to give each column a variable name and then use those values in each step of a loop. In bash, I believe you could use a while loop to do this or possibly a cat command, but I am super new to programming and I'm having trouble decoding... (2 Replies)
I am having a text file
best = 100
genre = 75
group = 53
.
.
and so on
I need to read those values (100,75,53,...) from my shell script. I have to do the same function for all the variables. So in my script i used for loop to do the same.
for {
a=best
b=100
}
Video tutorial on... (3 Replies)
In the bash below I am asking the user for a panel and reading that into bed. Then asking the user for a file and reading that into file1.Is the grep in bold the correct way to apply the selected panel to the file? I am getting a syntax error. Thank you :)
... (4 Replies)
Hi all,
Given here under a section of a script I am using.
SIMDIR="/home/Ins/forces"
cd $SIMDIR
for file in `ls *.forces`
do
basename=`echo $file | sed 's/\.*$//'`
extname=`echo $file | sed 's/*\(*\)\.\(.*\)/\2\1/'`
echo "Processing file: "$basename
python convert.py... (4 Replies)
Hello, I have a file in the following format
id sample platform R1 R2 gene1 gene2 gene3
1 abc llumina R1_001.fastq.gz R2_001.fastq.gz apoe prnpp asp
2 def llumina R1_001.fastq.gz R2_001.fastq.gz apoe prnpp
3 ghi llumina ... (3 Replies)
Hello Team,
I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file.
Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies
LEARN ABOUT OPENSOLARIS
fmt
fmt(1) User Commands fmt(1)NAME
fmt - simple text formatters
SYNOPSIS
fmt [-cs] [-w width | -width] [inputfile]...
DESCRIPTION
fmt is a simple text formatter that fills and joins lines to produce output lines of (up to) the number of characters specified in the -w
width option. The default width is 72. fmt concatenates the inputfiles listed as arguments. If none are given, fmt formats text from the
standard input.
Blank lines are preserved in the output, as is the spacing between words. fmt does not fill nor split lines beginning with a `.' (dot), for
compatibility with nroff(1). Nor does it fill or split a set of contiguous non-blank lines which is determined to be a mail header, the
first line of which must begin with "From".
Indentation is preserved in the output, and input lines with differing indentation are not joined (unless -c is used).
fmt can also be used as an in-line text filter for vi(1). The vi command:
!}fmt
reformats the text between the cursor location and the end of the paragraph.
OPTIONS -c Crown margin mode. Preserve the indentation of the first two lines within a paragraph, and align the left margin of
each subsequent line with that of the second line. This is useful for tagged paragraphs.
-s Split lines only. Do not join short lines to form longer ones. This prevents sample lines of code, and other such for-
matted text, from being unduly combined.
-w width | -width Fill output lines to up to width columns.
OPERANDS
inputfile Input file.
ENVIRONMENT VARIABLES
See environ(5) for a description of the LC_CTYPE environment variable that affects the execution of fmt.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO nroff(1), vi(1), attributes(5), environ(5)NOTES
The -width option is acceptable for BSD compatibility, but it may go away in future releases.
SunOS 5.11 9 May 1997 fmt(1)