06-13-2008
get the data in a file into single string
Hello everyone !
I need to get the data in a file into a string.
file1
1
2
3
4
5
I need to write a script where the file1 info is stored in a string (say variable s). So the output should be
1,2,3,4,5 or (1,2,3,4,5)
If i say
echo $s or print $s
output should be
1,2,3,4,5
or
(1,2,3,4,5)
Is this possible ? let me know what changes I need to do in the following script
while read file1
do
var=`echo $file1`
temp=`echo $temp","$var"`
echo $temp
done<file1
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
Can anyone help me with the task below?
Example:
The contents in fileA.txt are:
HELLO
HOW DO U DO?
The contents in fileA.txt are:
HI
I AM FINE.
how to combine the data in 2 files into one with the format below?
Case A-fileA.txt
HELLO
HOW DO U DO?
Case B-fileB.txt (4 Replies)
Discussion started by: c0384
4 Replies
2. UNIX for Dummies Questions & Answers
hi!
i have a file consisting of the following lines:
(BTW, = space)
.
.
.
12ME_T1mapping_flip30bshortf
13DCE_whole_brainbshortf
13DCE_3Dbshortf
.
.
.
the list of scans starts at 1 and goes on sometimes up to 60 scans. i would like to change only the lines that contain 'whole' to... (2 Replies)
Discussion started by: nixjennings
2 Replies
3. Shell Programming and Scripting
Hi,
I have a file with data as follows:
324dsadfasfgf23<xmlsssssssssssssssssssssssssssssssssssssss<fdf>dfsdf>
i need all the data followed by the string <xml?
Is it possible to retrieve it? (1 Reply)
Discussion started by: Vijay06
1 Replies
4. Shell Programming and Scripting
Can someone tell me how I can do this?
e.g:
Say file1.txt contains:
today is monday
the 22 of
NOVEMBER
2010
and file2.txt contains:
the
11th
month
of
How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies
5. Shell Programming and Scripting
Hi, I have a single colum file and I need to reformat the file so that it creates a new line every time it come to an IP address and the following lines are corresponding rows until it comes to the next IP address.
I want to turn this
172.xx.xx.xx
gwpusprdrp02_pv
seinwnprd03... (7 Replies)
Discussion started by: kieranfoley
7 Replies
6. Shell Programming and Scripting
Hi All, found similar posts, but not exatcly what i wanted.
I have an text file like below and am trying to send mail as an excel file but when i get the excel file as the attachment, all the data is coming in the first column. I need below data in 4 columns.
Unix file
Name,ID,Trade,Date... (3 Replies)
Discussion started by: robinbannis
3 Replies
7. Shell Programming and Scripting
I have a file in unix with sample data as follows :
--------------------------------------------------------------
--------------------------------------------------------------
{30001002|XXparameter|Layout|$
I want this file to be splitted into different files and corresponding to the sample... (54 Replies)
Discussion started by: Ravindra Swan
54 Replies
8. Shell Programming and Scripting
Hi All,
Need your inputs for the below.
I have 2 different servers 611 & 610, where i would be running two scripts. And would would be running one script from 611 at every 4 hours to merge the data from the 2 servers into 2 files and send a mail.
so below is the code snippet for 611:
... (3 Replies)
Discussion started by: ss_ss
3 Replies
9. Shell Programming and Scripting
1)In a particualr path i have a set of inputfiles like
path:/defaultmis/MonthlyLoads/INFA_EXPORT_022013/map*
example:
1)map_de
2)map_cod
3)map_feg
........and so on
in above path there wil be nearly 15 to 20 files starting with map and in other path i have another file input file... (4 Replies)
Discussion started by: katakamvivek
4 Replies
10. Shell Programming and Scripting
Hi Experts,
I have created multiple scripts and send the output to new file, getting this output to my mailbox on daily basis.
I would like to send the all outputs to a single file, need to merge all file outputs on a single file.
For example,
Created script for
df -h > df.doc
grep... (7 Replies)
Discussion started by: seenuvasan1985
7 Replies
LEARN ABOUT DEBIAN
sc_warts2pcap
SC_WARTS2PCAP(1) BSD General Commands Manual SC_WARTS2PCAP(1)
NAME
sc_warts2pcap -- write packets included in warts object to a pcap file.
SYNOPSIS
sc_warts2pcap [-o outfile] [-s sort] [file ...]
DESCRIPTION
The sc_warts2pcap utility provides the ability to extract packets embedded in the tbit, sting, and sniff warts objects and write them to a
pcap file, which can be read by tcpdump and wireshark. The options are as follows:
-o outfile
specifies the name of the output file. If no output file is specified, it will be written to the standard output, provided that it
is not a tty.
-o sort
specifies how the pcap records (packets) are sorted before being written out. By default, no sorting is applied; the packets are
grouped as they are in the warts file. If packet sorting is specified, the packets are written out in timestamp order. Note that
this operation requires the packets to be read into memory to be sorted, so it will require a corresponding amount of memory to com-
plete.
EXAMPLES
The command:
sc_warts2pcap -o output.pcap file1.warts file2.warts
will read the packet objects from file1.warts, and then file2.warts, and write them to output.pcap.
The command:
gzcat file1.warts.gz | sc_warts2pcap -s packet >file1.pcap
will read the contents of the uncompressed warts file supplied on stdin, sort the packets by their timestamp, and then write the output to
file1.pcap.
SEE ALSO
scamper(1), tcpdump(1)
AUTHORS
sc_warts2pcap is written by Stephen Eichler and Matthew Luckie.
BSD
October 15, 2010 BSD