Sponsored Content
Full Discussion: CSV file
Top Forums UNIX for Advanced & Expert Users CSV file Post 302493810 by ctsgnb on Thursday 3rd of February 2011 06:14:23 PM
Old 02-03-2011
Quote:
Originally Posted by GRS64
Thanks for the reply. I generated a file as you suggested and looked at the readable character it put in to the TextCSV file the showed up as "bread"$ where the $ was coloured blue. There was a $ characters after every line so when I tried in import it again I have all the names listed in a single column with each on a different row.


So I tried to change the text file I had generated with the files names in it. The $ was just put in as a $ straight from the key board (just in black) but when the text files was imported using TextCSV into open office all the file names were in one row and one column.

Clearly the $ was not being recognised as a control character.

Do not quite know where to go from here
The $ you see just means "end of line" so you don't need to add these.
to go back to display in a normal way use :

:se nolist (still in vi command mode)

You must just make sure that the file you want to generate with your script look like the one you have edited with vi.

1) Could you please provide your all code ?

maybe try something like:
Code:
echo "$LINE," >> import.txt

2) or :

Code:
cd folder
ls -1 | sed 's/$/,/' >>import.txt


Last edited by ctsgnb; 02-03-2011 at 07:20 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to compare two csv files values and write into another csv file

Hi all, Am new to scripting. So i just need your ideas to help me out. Here goes my requirement. I have two csv files 1.csv 2.csv abc,1.24 abc,1 def,2.13 def,1 I need to compare the first column of 1.csv with 2.csv and if matches then need to compare... (2 Replies)
Discussion started by: chinnahyd
2 Replies

2. Shell Programming and Scripting

2 problems: Mailing CSV file / parsing CSV for display

I have been trying to find a good solution for this seemingly simple task for 2 days, and I'm giving up and posting a thread. I hope someone can help me out! I'm on HPUX, using sqlplus, mailx, awk, have some other tools available, but can't install stuff that isn't already in place (without a... (6 Replies)
Discussion started by: soldstatic
6 Replies

3. Shell Programming and Scripting

Reading from a CSV and writing in same CSV file

Hi, I am tryng to read from a csv file and based on some grep command output I will modify one of the column in the same csv. Example:- Input CSV:- 20120829001415,noneAA,google.com 20120829001415,dfsafds,google.com 20120829001415,noneAA,google.com Intermediate Step:- If 2nd column of... (3 Replies)
Discussion started by: kmajumder
3 Replies

4. Shell Programming and Scripting

Comparing 2 CSV files and sending the difference to a new csv file

(say) I have 2 csv files - file1.csv & file2.csv as mentioned below: file1.csv ID,version,cost 1000,1,30 2000,2,40 3000,3,50 4000,4,60 file2.csv ID,version,cost 1000,1,30 2000,2,45 3000,4,55 6000,5,70 ... (1 Reply)
Discussion started by: Naresh101
1 Replies

5. Shell Programming and Scripting

Compare 2 csv files in ksh and o/p the difference in a new csv file

(say) I have 2 csv files - file1.csv & file2.csv as mentioned below: file1.csv ID,version,cost 1000,1,30 2000,2,40 3000,3,50 4000,4,60 file2.csv ID,version,cost 1000,1,30 2000,2,45 3000,4,55 6000,5,70 The... (7 Replies)
Discussion started by: Naresh101
7 Replies

6. Shell Programming and Scripting

Match columns from two csv files and update field in one of the csv file

Hi, I have a file of csv data, which looks like this: file1: 1AA,LGV_PONCEY_LES_ATHEE,1,\N,1,00020460E1,0,\N,\N,\N,\N,2,00.22335321,0.00466628 2BB,LES_POUGES_ASF,\N,200,200,00006298G1,0,\N,\N,\N,\N,1,00.30887539,0.00050312... (10 Replies)
Discussion started by: djoseph
10 Replies

7. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

8. Shell Programming and Scripting

Save output of updated csv file as csv file itself

Hi, all I want to sort a csv file based on timestamp from oldest to newest and save the output as csv file itself. Here is an example of my csv file. test.csv SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0739.JPG,2015:02:17 11:32:21 /home/intannf/foto/IMG_0749.JPG,2015:02:17 11:37:28... (10 Replies)
Discussion started by: refrain
10 Replies

9. Shell Programming and Scripting

Save output of updated csv file as csv file itself, part 2

Hi, I have another problem. I want to sort another csv file by the first field. result.csv SourceFile,Airspeed,GPSLatitude,GPSLongitude,Temperature,Pressure,Altitude,Roll,Pitch,Yaw /home/intannf/foto5/2015_0313_090651_219.JPG,0.,-7.77223,110.37310,30.75,996.46,148.75,180.94,182.00,63.92 ... (2 Replies)
Discussion started by: refrain
2 Replies
MIB2C(1)							     Net-SNMP								  MIB2C(1)

NAME
mib2c -- generate template code for extending the agent SYNOPSIS
mib2c [-h] -c CONFIGFILE [-I PATH] [-f OUTNAME] [-i][-s][-q][-S VAR=VAL] MIBNODE DESCRIPTION
The mib2c tool is designed to take a portion of the MIB tree (as defined by a MIB file) and generate the template C code necessary to implement the relevant management objects within it. In order to implement a new MIB module, three files are necessary: - MIB definition file - C header file - C implementation file. The mib2c tool uses the MIB definition file to produce the two C code files. Thus, mib2c generates a template that you can edit to add logic necessary to obtain information from the operating system or application to complete the module. MIBNODE is the top level mib node you want to generate code for. You must give mib2c a mib node (e.g. ifTable) on the command line, not a mib file. This is the single most common mistake. The mib2c tool accepts both SMIv1 and SMIv2 MIBs. mib2c needs to be able to find and load a MIB file in order to generate C code for the MIB. To enable mib2c to find the MIB file, set the MIBS environment variable to include the MIB file you are using. An example of setting this environment variable is: MIBS=+NET-SNMP-TUTORIAL-MIB or MIBS=ALL The first example ensures that mib2c finds the NET-SNMP-TUTORIAL-MIB mib, in addition to the default MIB modules. The default list of MIB modules is set when the suite is first configured and built and basically corresponds to the list of modules that the agent supports. The second example ensures that mib2c finds all MIBs in the search location for MIB files. The default search location for MIB files is /usr/share/snmp/mibs. This search location can be modified by the MIBDIRS environment variable. Both the MIB files to be loaded and the MIB file search location can also be configured in the snmp.conf file. Please see snmp.conf(5) for more information. The generated *.c and *.h files will be created in the current working directory. OPTIONS
-h Display a help message. -c CONFIGFILE Use CONFIGFILE when generating code. These files will be searched for first in the current directory and then in the /usr/share directory (which is where the default mib2c configuration files can be found). Running mib2c without the -c CONFIGFILE option will display a description of the valid values for CONFIGFILE, that is, the available config files, including new ones that you might author. For example, % mib2c ifTable will display a description of the currently available values for CONFIGFILE. The following values are supported for CONFIGFILE: mib2c.mfd.conf mib2c.scalar.conf mib2c.int_watch.conf mib2c.iterate.conf mib2c.create-dataset.conf mib2c.array-user.conf mib2c.column_defines.conf mib2c.column_enums.conf GENERATING CODE FOR SCALAR OBJECTS: If you're writing code for some scalars, run: mib2c -c mib2c.scalar.conf MIBNODE If you want to magically "tie" integer variables to integer scalars, use: mib2c -c mib2c.int_watch.conf MIBNODE GENERATING CODE FOR TABLES: The recommended configuration file for tables is the MIBs for Dummies, or MFD, configuration file. It hides as much of the SNMP details as possible, generating small, easy to understand functions. It is also the most flexible and well documented configuration file. See the agent/mibgroup/if-mib/ifTable/ifTable*.c files for an example: mib2c -c mib2c.mfd.conf MIBNODE If your table data is kept somewhere else (e.g. it's in the kernel and not in the memory of the agent itself) and you need to "iter- ate" over it to find the right data for the SNMP row being accessed. See the agent/mibgroup/mibII/vacm_context.c file for an exam- ple: mib2c -c mib2c.iterate.conf MIBNODE If your table data is kept in the agent (i.e. it's not located in an external source) and is purely data driven (i.e. you do not need to perform any work when a set occurs). See the agent/mibgroup/examples/data_set.c file for an example of such a table: mib2c -c mib2c.create-dataset.conf MIBNODE If your table data is kept in the agent (i.e. it's not located in an external source), and you can keep your data sorted by the ta- ble index but you do need to perform work when a set occurs: mib2c -c mib2c.array-user.conf MIBNODE GENERATING HEADER FILE DEFINITIONS To generate just a header with a define for each column number in your table: mib2c -c mib2c.column_defines.conf MIBNODE To generate just a header with a define for each enum for any column containing enums: mib2c -c mib2c.column_enums.conf MIBNODE GENERATING CODE FOR THE 4.X LINE OF CODE (THE OLDER API) mib2c -c mib2c.old-api.conf MIBNODE -IPATH Search for configuration files in PATH. Multiple paths can be specified using multiple -I switches or by using one with a comma separated list of paths in it. -f OUTNAME Places the output code into OUTNAME.c and OUTNAME.h. Normally, mib2c will place the output code into files which correspond to the table names it is generating code for, which is probably what you want anyway. -i Do not run indent on the resulting code. -s Do not look for MIBNODE.sed and run sed on the resulting code. This is useful to shorten long mib variable names in the code. -q Run in "quiet" mode, which minimizes the status messages mib2c generates. -SVAR=VAL Preset a variable VAR, in the mib2c.*.conf file, to the value VAL. None of the existing mib2c configuration files (mib2c.*.conf) currently makes use of this feature, however, so this option should be considered available only for future use. EXAMPLES
The following generates C template code for the header and implementation files to implement UCD-DEMO-MIB::ucdDemoPublic. % mib2c -c mib2c.scalar.conf ucdDemoPublic writing to ucdDemoPublic.h writing to ucdDemoPublic.c running indent on ucdDemoPublic.h running indent on ucdDemoPublic.c The resulting ucdDemoPublic.c and ucdDemoPublic.h files are generated the current working directory. The following generates C template code for the header and implementation files for the module to implement TCP-MIB::tcpConnTable. % mib2c -c mib2c.iterate.conf tcpConnTable writing to tcpConnTable.h writing to tcpConnTable.c running indent on tcpConnTable.h running indent on tcpConnTable.c The resulting tcpConnTable.c and tcpConnTable.h files are generated in the current working directory. SEE ALSO
snmpcmd(1), snmp.conf(5) V5.6.2.1 05 Apr 2010 MIB2C(1)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy