04-04-2006
Thank you all. Both of your code generated almost same output in terms of line breaks, second code didn't work with multiple redundent lines.
First output,
AA001897 SPTA1
AA001918 MI-ER1^M /// ER1^M /// KIAA1610^M /// DKFZp781G0451
AA001924 Cep63^M /// FLJ13386
AA001950 KIF13A
AA001952 -
AA001970 -
AA001976 -
Second output,
AA001897 SPTA1
AA001918 MI-ER1^M /// ER1
AA001918 MI-ER1^M /// KIAA1610
AA001918 MI-ER1^M /// DKFZp781G0451
AA001924 Cep63^M /// FLJ13386
AA001950 KIF13A
AA001952 -
AA001970 -
AA001976 -
AA002006 -
I just wonder if this is my os problem or not. I am using Mac OS X, and bash shell.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
I've searched the web and this forum for this but not had any luck. I'm trying to use sed so when it finds a space it will insert a new line.
What i have is a file containing .e.g
1 2 4 7 9
and want it to look like
1
2
4
7
9
I've tried:
more test2 | sed 's/ /\\n/g'... (1 Reply)
Discussion started by: Cordially
1 Replies
2. Shell Programming and Scripting
Hi all!
I have a problem with line command. The aim is to write each line of stdin into a text file.
For example with this command:
$find /
/usr/share/zoneinfo/WET
/usr/share/zoneinfo/Zulu
/usr/share/zoneinfo/iso3166.tab
/usr/share/zoneinfo/localtime
/usr/share/zoneinfo/zone.tab... (3 Replies)
Discussion started by: victorin
3 Replies
3. Shell Programming and Scripting
Hi everyone. I realise this is probably a bit of a noob question, but I'm actually a C# developer working on a legacy system, and can't remember much unix.
I want to read from a pipe-delimeted file like formatted thusly:
idno|PRODUCT|Name|street town postcode|etc|etc|etc|etc... (4 Replies)
Discussion started by: Darkness Fish
4 Replies
4. Shell Programming and Scripting
At first, give my best wish for all MOD and admins here. I"m learning bash shell program just for a month, not too much, not too little, but i must admire that i'm very bad at math and algorithm. :(
I want to do this :
Read the content of a file line by line and at each line, ask me want to... (3 Replies)
Discussion started by: madi3d8
3 Replies
5. Shell Programming and Scripting
So, I want to read line-by-line a text file with unknown number of files....
So:
a=1
b=1
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
done
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies
6. Shell Programming and Scripting
Hi everybody, I am new to shell script. Please help me with this problem.
I have a file test.txt with the content like this:
I have a shell script test.sh like this
#!/bin/sh
while read line
do
echo $line >> out.txt
done < test.txt
out.txt is expected to have the same content... (10 Replies)
Discussion started by: Dark2Bright
10 Replies
7. Shell Programming and Scripting
hi ,
i need to check the first line of a tilde(~) delimitted source file, so i wrote a command as follows
head -1 <source filename>
but the problem is that the line is too lengthy,as it spans out of the window,so im not able to see the line till end.can anybody please suggest a workaround... (2 Replies)
Discussion started by: angel12345
2 Replies
8. Shell Programming and Scripting
Hi folks,
I've list of LDAP records in this format:
cat cmmac.export.tmp2
dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc
cmmac: 00:13:11:36:a5:06
dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc
cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies
9. Shell Programming and Scripting
Hi All,
Please can you advise/help on the below issue
i did a bcp out of a table, it is having problem of line break such that one line is getting broken in two lines for many records.
eg
Correct format
Line 1: - 000f00000bfe2c2c 000218310300000000GBP GBP 734654 10970.35 ... (3 Replies)
Discussion started by: mad_man12
3 Replies
10. UNIX for Dummies Questions & Answers
i have a file like below
New_file.txt
123|345|ab cd|ef gh
345|456|jk hu|uyh
My script is
#!/bin/ksh
set -x
for line in `cat New_file.txt`
do
a1=`echo $line|cut -d '|' -f1`
echo $a1
done
output
++ cat New_file.txt (2 Replies)
Discussion started by: Rajesh_us
2 Replies
LEARN ABOUT DEBIAN
dbview
DBVIEW(1) Database Management DBVIEW(1)
NAME
dbview - View dBase III files
SYNOPSIS
dbview [-b|--browse] [-d delim| --delimiter delim] [-D|--deleted] [-e|--description] [-h|--help] [-i|--info] [-o|--omit] [-v|--version]
[-r|--reserve] [-t|--trim] dbfile
DESCRIPTION
Dbview is a little tool that will display dBase III files. You can also use it to convert your old .dbf files for further use with Unix.
It should also work with dBase IV files, but this is mostly untested.
By default dbview displays the contents of a dBase III or IV database file. This is be done by displaying both the name of the field
itself and its value. At the end of every record a newline is appended.
OPTIONS
If no option given dbview only displays the database in its most friendly way.
--browse, -b
switches into browse mode. Using this mode no fieldnames will be displayed, instead every record will displayed in one line using a
delimiter to separate fields.
--delimiter, -d delimiter
The default delimiter in browse mode is the colon sign ``:''. This parameter overrides it. This can be useful especially if you
plan to examine the output with scripts.
--deleted, -D
displays deleted records as well as the delete state in each record in the database.
--description, -e
displays the field description of the database.
--help, -h
displays a complete (or short) help screen.
--info, -i
displays some (partially technical) information about the database like number of records and length of each record.
--omit, -o
omits displaying the whole database. Using this parameter can be useful if you're only interested in the structure.
--reserve, -r
Normally fieldnames are converted into a more friendly format. They are stored in capital letters, but that looks like shouting.
This parameter supresses the conversion.
--trim, -t
When this option is specified, leading and trailing spaces are omitted. This might be useful when in browse mode.
--version, -v
displays version and exits.
NOTES
As dBase is DOS, umlauts are stored using a different code table (namely ASCII) than most modern unices (namely ANSI). If you encounter
such a file, I would recommend piping the output through recode(1) with ibmpc:latin1 as it's argument.
If you want to examine the output generated by the browse mode, just take cut(1) and set its delimiter to the used delimiter or take awk(1)
and continue.
COPYRIGHT
Dbview is free software. It is based on routines from unknown source that I found on nic.funet.fi in /pub/msdos/languages/c as dbase.c.
The file contained the following notice:
These functions are provided by Valour Software as a gift.
I have modified and included this file and wrote a skeleton around it. All together provides a powerful tool for dBase III and IV database
manipulation under Unix.
I mainly have written this program, because I've got several dbase files containing important information for me. As I won't go running
DOS everytime I need some of the stored information, I had to find a viewer that runs unter Unix, resp. Linux, but unfortunately didn't
find one. So it was my turn.
This package as a whole is published under the GNU Public License, which is a great invention.
It wasn't the intention to write a freaking viewer and reinvent the wheel again. Instead dbview is intend to be used in conjunction with
your favourite unix text utilities like cut, recode and more.
Martin Schulze
Infodrom Oldenburg
joey@infodrom.north.de
SEE ALSO
recode(1), more(1), awk(1), cut(1).
Unix November 20th, 2006 DBVIEW(1)