Programming :: Join 5 Lines Blocks Comma Delimited?
Nov 26, 2010
I have been searching previous posts but could not find an example which works with my data. I think I might be the spaces in my fields. I have a massive data file and need to join 5 line blocks separated by a comma.
Code:
2
111.222.333.444
host.edu
[code].....
View 8 Replies
ADVERTISEMENT
Nov 23, 2010
I would like to create csv output from an ipcalc calculation.
Code:
[me@host scripts]$ ./ipcalc 192.168.30.40/255.255.255.248
Address: 192.168.30.40 11000000.10101000.00011110.00101 000
[code]....
View 1 Replies
View Related
Mar 10, 2009
I have a script that output all my data in to a comma-delimited file separated by ";"
Current Output:
Quote:
"SAP 1117A";10.94.1.7;239.234.1.12;0;0;0;0;0;3;172.31.207.45;""
"";NA;239.192.1.50;0;0;0;0;0;3;172.31.207.61;""
"";NA;239.192.1.50;0;0;0;0;0;3;172.31.207.62;""
[code]...
I would like to remove all lines that have an NA in the second field.
New Output
Quote:
"SAP 1117A";10.94.1.7;239.234.1.12;0;0;0;0;0;3;172.31.207.45;""
....
View 4 Replies
View Related
Apr 7, 2010
need to monitor pecific processes over a time frame in terms of the amount of memory and cpu usage it utilizes. I can do this using the top -p <pid> option and using ps to retrieve the pid's. However, seeing that the pid's might differ and it needs to be run on about 13 different machines, I would like to write a script for this that can be run at set intervals. My problem that I have is this:
- When running top -p <pid> I can specify a comma seperated list of the processes required to monitor at that specific time.
- I can use ps -ef | grep <process> | grep -v grep| awk '{ print $2 }' to retrive the list of pid's and output this to a file.
However, how can I output these to the file as a comma seperated list without having to manually do this every time? The reason for this is (an example), lets say I want to monitor the cpu and memory usage of postgresql as well as all its child processes, then I would ps grep for postgres and get the list of pid's for instance.This list then needs to be passed to top -p as a comma seperated list of pid's I suspect that awk or sed might have some options available for this but I do not know this well enough.
View 11 Replies
View Related
Aug 21, 2010
I have a plain text file with 360 lines of varying length text. How do I add a comma or other symbol to the end of each line so that I can convert the file to csv format that I can open in a spreadsheet (45 rows, 8 columns). That means each 8 lines of text forms 8 columns, with 45 rows.
View 9 Replies
View Related
Jul 1, 2010
I have a large CSV file, tab-delimited with CRLF at the end of each line. Each line should contain 5 fields (i.e. NF == 5) However, there are rogue CRLF characters in the middle of some records, causing records to be split across two lines. I want to scan each line, check the field count and if it's !=5 then join that line to the following line. Example input might be;
Code:
one two three four five
six seven eight nine ten
eleven tw<CRLF>
elve thirteen fourteen fifteen
[code].....
View 2 Replies
View Related
May 22, 2010
I am looking for an application that will read the file names in a folder and generate a comma delimited file. I want then to import the comma delimited file contests to a spread sheet such as open office.I hava a number of PDF files generated from a scanner, each file with its own scaner generated file name. I want to put these into a data base so I can add the title and other reference information to provide a data base.
View 7 Replies
View Related
Nov 10, 2010
I have a CSV file that's created in an application that can't output lines longer than 250 characters. the data fields, all together, are longer than this. how would I remove the line break from every line that ends with a comma? For example:
A,B,C
D,E,
F
G,H,I
becomes:
A,B,C
D,E,F
G,H,I
View 1 Replies
View Related
Feb 9, 2010
i'm trying to get several strings from a single string, separated by comma's.there are comma's that do not separate strings, however, those enclosed in parantheses.an example would be:vt, word1, (word2, word3)word4
exploding by ',' would result in:
[0]=>vt
[1]=>word1
[code]....
View 2 Replies
View Related
Mar 4, 2010
Suppose i have a file(1.txt) separated by TAB delimiter in a line
1 B AB 2
2 C AB 2
if I need to search for the records having B?? using grep.If i need to perform multiple search like line having "C and AB" or "B and AB"??
View 5 Replies
View Related
Mar 21, 2010
I'm trying to compose a line of numbers each single digit taken from a variable eg: 1010001 each variable digit is either a 0 or 1 made from variable layer1 through 7. I need to add each layer variable to the last to compose the number with no commas or spaces and add it directly after the -p option in the show_command line. I used array and list and the commas mess up the command and inserting "pens" in the show command interpertes it literally instead of the list or array value? The insert should look something like 1000110
Code:
View 1 Replies
View Related
Sep 4, 2010
I have a requirement like this:Cut the characters from each line of a file with following positions: 21-24, 25-34 ,111-120.Thse fields now need to be placed in a tab delimited output file.Currently this is how I am achieving it:
#!/bin/sh
cat newsmaple.txt | cut -c 21-24 > out1.txt
cat newsmaple.txt | cut -c 25-34 >out2.txt
[code]....
View 1 Replies
View Related
Jan 6, 2010
I am trying to do this:
1. Read csv delimited file line1 and store all values in array
2. Use the values stored in the array and replace values in other text file with them
3. read line2 in the cvs file and repeat the process
4. Do above for all lines in the cvs file
for example:
file1.cvs content:
text1,text2,text3,"text 4"
a1,a2,3,"a 4"
file.txt content:
some text $array1$ some text
some text $array2$ some text
1. read line 1 - text1,text2,text3,"text 4" put each value in array X[] lines that contain spaces in cvs will have double quotes
2. read x[1] and replace value $array1$ (in file.txt) with x[1]read x[2] and replace value $array2$ (in file.txt) with x[2] and so on
Can above be accomplished in BASH and how?
View 1 Replies
View Related
Sep 26, 2010
I have a pipe delimited flat file, field 27 is price. I would like to move items marked sold to a new file every couple months.
awk -F"|" '$27 == "SOLD" {print $0}' awktest2.data >> awkout2.data
Allows me to write line to new file but I need to delete the original line, I also want to make sold case insensitive tried [Ss][Oo] with no luck
View 4 Replies
View Related
Apr 9, 2010
I am in the process of learning some scripting, however I am running into a roadblock in specifying a certain time format in the array. Ideally I would like to use Here are the lines of text that I am interrogating:
1123,3/25/2010,00:14 Thu,33229
1124,3/26/2010,13:30 Fri,33230
1125,3/27/2010,04:49 Sat,33231
[code]...
View 2 Replies
View Related
Nov 24, 2009
How do you remove parts of strings using python? Such as, if I have something like:
Code:
erme1 sdifskenklsd
erme2 sdfjksliel
[code]....
View 3 Replies
View Related
Mar 2, 2011
I am trying to understand the join command. I wish to join two files:
Code:
$ cat test1
a 0
b 2.51
c 19.85
$ cat test2
a 0
b 2.51
[Code]...
this is great but I do not understand why join ignores the -e flag and fails to insert FOO in the empty field.
View 1 Replies
View Related
May 4, 2010
with my question (I�m using Cygwin). How can I join the 2 AWK scripts showed below in a unique script avoiding use temp file?
I have this input file Pipe separated. Code: CATEGORY1|CATEGORY2|CATEGORY3|CATEGORY4
String3|MUSIC/OLDIES/POP/80S/SONGW|String4|
String4|MUSIC/OLDIES/ROCK/70S/SONGX|String5|
[code]....
View 1 Replies
View Related
Jun 2, 2010
I have encountered this scenario wherein malloc does not return.
Code:
char * tmp;
rs = 100 to 40000 bytes
[code]...
View 8 Replies
View Related
Aug 19, 2010
I have a bunch of files that contain a date, then data. When I use join, I get exactly the output I need. But manually joining the first with the second, then that output with the third and so on would take days. I have thousands of files. Can any of you folks help me write a script that would do this?To put it another way, for clarity's sake, here is what I am currently doing
If I were to repeat that 3000 times the final output would be what I need. I know a simple script would do this for me, but I can't figure out how to write it.
View 12 Replies
View Related
Jan 18, 2010
I have created an application that has a executable program that loads in a shared object
the shared object loads in another shared object
both of these shared object I have created
For debugging I have been printf'in data to determine what is going on
I now have some odd memory issue, and need a bit more control over debugging...
I have one workspace set up and under my exectuable(will call maintest from now on) I have two items in my link libraries under project build options being soA and soB (so A is the shared object that maintest uses, soB is the SO that soA uses) I also have linker options pthread and ldl
At the beginning of my maintest I do my dlsym and load in each function that I will be using
I always run my program using maintest, because when I have one of the SO as the startup project(turns bold) and try to run it gives me "You must select a host application to run a library"
I tried to set up this host library, i Go to Menu->Project->SetProgramArguments and change the Host Application to the debug version of my maintest
I then hit OK and try to run again but I get the same error: "You must select a host application to run a library"
If I get this part working - which I need help doing, is tehre other steps that need to be taken to debug the so's? or will this make it so when i hit f8 it will run.
View 1 Replies
View Related
Sep 9, 2010
My problem is that for an encrypted server my client blocks after I send the QUIT command to the server and I do not know the reason why my client blocks.
Language C, Library openssl, IP4.
Compiler: gcc.
Output:
send: STLS
receive: +Ok ssl handshake
send: USER XXXXX
receive: +OK
send: PASS ***
receive: +OK
Send: STAT
receive: +Ok 0 0
send: QUIT
receive: blocks
At this point I need to use crtl^C to exit the program.
For the non-encrypted mail client everything works fine.
View 1 Replies
View Related
Aug 21, 2010
I am trying to make a perl script which reads data from a file and parse it. The data in the file has the following syntax
Code:
Device Physical Name : Not Visible
Device Symmetrix Name : 1234
Device Serial ID : N/A
Attached BCV Device : N/A
Device Capacity
[Code]...
Each unique record starts with "Device Physical Name". So, I have a set of records within "Device Physical Name". I want to read this set of records starting from "Device Physical Name" and ends up till next "Device Physical Name". Offcourse FS is ":", and I just want to print/or later put info in a csv file.
View 14 Replies
View Related
Jul 9, 2011
I am writing a C program which is contains Mysql header files and APIs but it can not compile it and its error is : Quote: undefined reference to
to all of Mysql APIs that I included their headers .In command line I compile my source like this with no problem: Quote: gcc test.c -Wall -o test -lz `mysql_config --cflags --include --libs`
I think code block does not have bold italic part of this command. How can I add this to code block to compile my project or those project that contains Mysql APIs (just my project not all of defined projects that has no relation to mysql APIs)with this gcc flags.
View 3 Replies
View Related
Jul 10, 2011
I am writing a C program which is contains Mysql header files and APIs but it can not compile it and its error is :
Quote:
undefined reference to
to all of Mysql APIs that I included their headers .In command line I compile my source like this with no problem:
Quote:
gcc test.c -Wall -o test -lz `mysql_config --cflags --include --libs`
I think code block does not have bold italic part of this command. How can I add this to code block to compile my project or those project that contains Mysql APIs (just my project not all of defined projects that has no relation to mysql APIs)with this gcc flags.
View 2 Replies
View Related
Jul 23, 2010
Is there a command which can be used to run some other command on a few lines from a file or an o/p of some file. (the kind of role that -exec option does for the find command). (I have solved the purpose using a bash loop but would like to know if there exists a command).
View 4 Replies
View Related
Apr 23, 2010
I tried to get a block of lines in awk, but unfortunately it returns output of one line only. I don't state the code here, because it's too short and too poor. What exactly I wanted to do: from file "/boot/grub/menu.lst" get blocks of lines, starting by title and ending by Now I have just
Code:
script="/boot/grub/menu.lst";
OLDIFS=$IFS; IFS=$'
';
[code]....
I want to get every block as one row of array.
View 14 Replies
View Related
Apr 20, 2011
I do a logcat, i got lot of lines, that I filter with a grep, at end, I just got some lines like this:
Code:
I/ActivityManager( 1763): Config changed: { scale=1.0 imsi=732/123 loc=es_ES touch=3 keys=2/1/2 nav=2/1 orien=1 layout=17 uiMode=17 seq=15}
[code]...
View 6 Replies
View Related
Nov 3, 2010
How can I remove all lines which contain A,,,,,, I tried the following sed statements but no luck.
Code:
sed "/A,,,,,,/d file"
sed "/A,,,,,,/d file"
View 6 Replies
View Related
Feb 23, 2011
whichever source code I go through I find these three lines of code written what do they actually mean and what is their function?
[code]...
View 6 Replies
View Related