Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Problems concatenating data using UNIX? Post 302917603 by brialp on Wednesday 17th of September 2014 05:23:57 PM
Old 09-17-2014
Problems concatenating data using UNIX?

Hello,
Can somebody help me to solve this inconsistent data issue. I have a pipe delimiter file and one of the column is a comment. I am trying to concatenate into one single sentence. For instance, I have a file actually with 2 records but the way it considers the first record is as different rows and hence loads into the table as different records. In the sample below, 123 and 789 are two different records.


Code:
123|efg|"Try to solve.
This is a unix script. Trying to concatenate.

It seems to be simple but not as simple once I start scripting.
Sincerly,
XYZ
ABC"|5|3|6 months
789|def|"Better way to solve this issue."|4|6|7 years

This is how it has to look.
Code:
abc|efg|"Try to solve. This is a unix script. Trying to concatenate. It seems to be simple but not as simple once I start scripting. Sincerly, XYZ ABC"|5|3|6 months
789|def|"Better way to solve this issue."|4|6|7 years

I first tried to remove the blank space using
Code:
sed '/^$/d' t1.txt > t2.txt

Then I couldn't figure out how to remove spaces after a period and concatenate the next sentence.

I would really appreciate any input on resolving this.

Last edited by Scrutinizer; 09-17-2014 at 06:52 PM.. Reason: CODE tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

concatenating static string to records in data file

I just need to add a static ID to each output record so the users will be able to tell which group records in combined flatfiles come from I have the static ID in a bourne variable. I tried awk '{print "${GroupID}" $0}' infile > outfile But I ended up with the string ${GroupID} instead of... (5 Replies)
Discussion started by: gillbates
5 Replies

2. UNIX for Advanced & Expert Users

how to read the data from an excel sheet and use those data as variable in the unix c

I have 3 columns in an excel sheet. c1 c2 c3 EIP_ACCOUNT SMALL_TS_01 select A.* from acc; All the above 3 col shoud be passed a variable in the unix code. 1.How to read an excel file 2.How to pass these data as variable to the unic script (1 Reply)
Discussion started by: Anne Grace
1 Replies

3. Shell Programming and Scripting

problems with a script that outputs data to a file

First of all, im a total newbie to the point that i do not know what are the terms to search for my problem. I did however spend the rest of the day today trying to figure out what is wrong with my bash script. ive always thought that the best way to learn is to tackle a problem heads on. but at... (1 Reply)
Discussion started by: joeribut
1 Replies

4. UNIX for Dummies Questions & Answers

Validating XSL sheet data in Unix Data file

Dear All, Need your help. In my day to day activities I have to validate/search Excel Sheet data (eg.say Application No. 0066782345) data into the Unix environment file whether the same data is present in that file or not. There are hundreds of records coming in excel file and I am doing grep... (1 Reply)
Discussion started by: ravijunghare
1 Replies

5. Shell Programming and Scripting

Excution Problems with loading huge data content and convert it

Hi, I got long list of referred file content: CGTGCFTGCGTFREDG PEOGDKGJDGKLJGKL DFGDSFIODUFIODSUF FSDOFJSODIFJSIODFJ DSFSDFDFSDOFJFOSF SDFOSDJFOJFPPIPIOP . . . Input file content: >sample_1 SDFDSKLFKDSLSDFSDFDFGDSFIODUFIODSUFSDDSFDSSDFDSFAS (14 Replies)
Discussion started by: patrick87
14 Replies

6. Shell Programming and Scripting

Execution Problems with scan and change file data content

Input file >Read_1 XXXXXXXXXXSDFXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXAXXXXGXXA . . Desired output file >Read_1 XXXXXXXXXXXXXXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXXXXXXXXXA . . (5 Replies)
Discussion started by: patrick87
5 Replies

7. Shell Programming and Scripting

Concatenating the lines of a data

I have a data of 1 lac lines with the following format abcde,1,2,3,4, ,ee ,ff ,gg ,hh ,mm abcde,3,4,5,6, ,we ,qw ,as ,zx ,cf abcde,1,5,6,7, ,dd ,aa ,er .... .... (6 Replies)
Discussion started by: aravindj80
6 Replies

8. Shell Programming and Scripting

Problems with fetching data from Oracle database

Here's a database query which looks up the NAME column of PRODUCT table SELECT NAME FROM PRODUCT ; And this query retrieves me the following output SUGAR COCOA HONEY WHEAT CABBAGE CAULI FLOWER Please note the last record CAULI FLOWER contains TWO blank spaces between the two words. ... (4 Replies)
Discussion started by: kumarjt
4 Replies

9. Red Hat

Problems with EURO symbol in a data flat file

Hi, I'm creating a flat file with various deimiters in Linux RHEL. the content for the flat file will be extracted from an oracle database. delimiters also stored in a seperate table in oracle databasae. when i use extended ASCII characters like cedilla or EURO (€) symbols, the actual character is... (9 Replies)
Discussion started by: Fakru.y
9 Replies
GPSFAKE(1)							GPSD Documentation							GPSFAKE(1)

NAME
gpsfake - test harness for gpsd, simulating a GPS SYNOPSIS
gpsfake [-1] [-h] [-b] [-f] [-c interval] [-i] [-D debuglevel] [-l] [-m monitor] [-n] [-o options] [-p] [-P port] [-r initcmd] [-s speed] [-u] [-v] [logfile...] DESCRIPTION
gpsfake is a test harness for gpsd and its clients. It opens a pty (pseudo-TTY), launches a gpsd instance that thinks the slave side of the pty is its GPS device, and repeatedly feeds the contents of one or more test logfiles through the master side to the GPS. If there are multiple logfiles, sentences from them are interleaved in the order the files are specified. gpsfake does not require root privileges, and can be run concurrently with a production gpsd instance without causing problems. The logfiles may contain packets in any supported format, including in particular NMEA, SiRF, TSIP, or Zodiac. Leading lines beginning with # will be treated as comments and ignored, except in the following special cases: o a comment of the form #Date: yyyy-mm-dd (ISO8601 date format) may be used to set the initial date for the log. o a comment of the form #Serial: [0-9]* [78][NOE][12] may be used to set serial parameters for the log - baud rate, word length, stop bits. o a comment of the form #Transport: UDP may be used to fake a UDP source rather than the normal pty. The gpsd instance is run in foreground. The thread sending fake GPS data to the daemon is run in background. OPTIONS
With the -1 option, the logfile is interpreted once only rather than repeatedly. This option is intended to facilitate regression testing. The -b enables a twirling-baton progress indicator on standard error. At termination, it reports elapsed time. The -c sets the delay between sentences in seconds. Fractional values of seconds are legal. The default is zero (no delay). The -l makes the program dump a line or packet number just before each sentence is fed to the daemon. If the sentence is textual (e.g. NMEA), the text is dumped as well. If not, the packet will be dumped in hexadecimal (except for RTCM packets, which aren't dumped at all). This option is useful for checking that gpsfake is getting packet boundaries right. The -i is for single-stepping through logfiles. It dumps the line or packet number (and the sentence if the protocol is textual) followed by "? ". Only when the user keys Enter is the line actually fed to gpsd. The -m specifies a monitor program inside which the daemon should be run. This option is intended to be used with valgrind(1), gdb(1) and similar programs. The -g uses the monitor facility to run the gpsd instance within gpsfake under control of gdb. The -f configures gpsd to bind to a random dynamic/private port (range 49152 - 65535). Its main use is within regression-test scripts so they won't collide with a production instance. The -o specifies options to pass to the daemon. The -n option passes -n to start the daemon reading the GPS without waiting for a client (equivalent to -o "-n"). The -D passes a -D option to the daemon: thus -D 4 is shorthand for -o "-D 4". The -p ("pipe") option sets watcher mode and dumps the NMEA and GPSD notifications generated by the log to standard output. This is useful for regression-testing. The -P ("port") option sets the daemon's listening port. The -r specifies an initialization command to use in pipe mode. The default is ?WATCH={"enable":true,"json":true}. The -s sets the baud rate for the slave tty. The default is 4800. The -u forces the test framework to use UDP rather than pty devices. This may be useful for testing from within chroot jails where access to pty devices is locked out. The -v enables verbose progress reports to stderr. It is mainly useful for debugging gpsfake itself. The -x dumps packets as gpsfake gathers them. It is mainly useful for debugging gpsfake itself. The -h makes gpsfake print a usage message and exit. The argument must be the name of a file containing the data to be cycled at the device. gpsfake will print a notification each time it cycles. Normally, gpsfake creates a pty for each logfile and passes the slave side of the device to the daemon. If the header comment in the logfile contains the string "UDP", packets are instead shipped via UDP port 5000 to the address 192.168.0.1.255. You can monitor them with this: tcpdump -s0 -n -A -i lo udp and port 5000. CUSTOM TESTS
gpsfake is a trivial wrapper around a Python module, also named gpsfake, that can be used to fully script sessions involving a gpsd instance, any number of client sessions, and any number of fake GPSes feeding the daemon instance with data from specified sentence logs. Source and embedded documentation for this module is shipped with the gpsd development tools. You can use it to torture-test either gpsd itself or any gpsd-aware client application. Logfiles for the use with gpsfake can be retrieved using gpspipe, gpscat, or gpsmon from the gpsd distribution, or any other application which is able to create a compatible output. If gpsfake exits with "Cannot execute gpsd: executable not found." the environment variable GPSD_HOME can be set to the path where gpsd can be found. (instead of adding that folder to the PATH environment variable SEE ALSO
gpsd(8), gps(1), libgps(3), libgpsd(3), gpsctl(1), gpspipe(1), gpsprof(1) gpsmon(1). AUTHOR
Eric S. Raymond esr@thyrsus.com. The GPSD Project 12 Feb 2005 GPSFAKE(1)
All times are GMT -4. The time now is 03:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy