General :: Adding A Comma To The End Of Every Nth Line In Vi (or Sed)?

Oct 12, 2009

I have a fairly long list of data that I am trying to put into a math program (maple) but before I can do that I need to edit the format of the data such that at the end of every 25th line I add a comma. I would prefer a solution that uses vi, but if that's impossible sed would be fine also (or awk).

View 6 Replies


ADVERTISEMENT

General :: Remove Line Breaks From Lines Ending With A Comma?

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

Programming :: Using Sed To Remove Line In A Comma-delimited File?

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

General :: Adding # To First Line

Jun 23, 2011

How Does sed or other command edit the 1st line in a file and comments it? Meaning add "#" to the first line in a file for example?

View 6 Replies View Related

General :: Adding Text To End Of Particular Line In Bash

Nov 30, 2010

I am looking at how to add particular text to a file in bash.Here is what I am trying to do:In the /etc/grub.conf file, I am trying to add "audit=1" (without the quotes) to the end of the kernel line...such as:kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/1 rhgb quiet audit=1

As there are a few different lines in this file, I am only looking to add the "audit=1" to the above line via a bash script.

View 7 Replies View Related

Programming :: Adding Line From File1 Into A Line Of Another File Based On Maching IDs

Jan 3, 2011

I wish to add information to one of my files based on matching IDs,

Here is an example

(the id is the 3 colunm)

(the ID is the 2 colunm)

And the output i wish to be

OUTPUT:

So as you can see the ones that do not match are still present, and the ones that do match just have the extra information from file2.txt added to them.

I thought about using join but that only seems to join the ones that match displays thoes only. i would like all the information in the output file.

View 6 Replies View Related

General :: Adding Line To A Queried List Of Files

Apr 19, 2011

I am trying to add a line of text to hgrc files for Mercurial Repo'sThe file is found normally in a hidden .hg directory under the repo.I need to add a "deny_read = username" to the end of each of these hgrc files. Suggestions either in shell script format, or a single line?

View 4 Replies View Related

General :: Adding A Live USB To A Repository Via Command Line [Kubuntu 10.04]?

Sep 3, 2010

Couple of days I go I setup VLC using Kubuntu's graphic software manager, and installed the 3 plug-ins, one of which was related to pulse. After doing this sound stopped working in flash videos. I had read, not sure where, that Kubuntu didn't use pulse (which slipped my mind when setting up VLC).

So I make the mistake of removing everything which had pulse in it's name (again, via the graphic software manager). A message popped-up saying that some packages needed to be removed/edited (a LONG list, a big clue that I was doing something stupid I guess). I let it run it's course and after that it won't boot properly.

If I boot it normally it hangs at the Kubuntu screen with the five dots filling endlessly. If I press F1 it's stuck at "checking battery status."

Recovery mode boots, but the recovery option does nothing.

So I was wondering if I could boot into recovery mode and go into the terminal and add a live USB as a repository for apt, and try to salvage the install?

Or should I admit defeat and reinstall?

View 1 Replies View Related

General :: Regex Escape The Comma?

Aug 12, 2010

sometimes there are one, sometime there are two exchanges in this log file. the 100= is the stock exchange- if there are two, they are seperated by a comma. i understand how to escape a comma in a regex, but I am having trouble with combining it.

35=8 39=1 38=1000 32=13 14=754 31=1.11 44=1.1 100=AMEX,ISE
35=8 39=1 38=1000 32=151 14=205 31=1.1 44=1.1 100=AMEX
35=U 39=2 38=1000 32=45 14=184 31=1.1 44=1.1 100=AMEX,ISE

[code]...

View 11 Replies View Related

General :: Output Pid's From Ps To A Comma Delimited File?

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

General :: Count Words With Comma As Separator?

Feb 16, 2010

I'm trying to count words in a text file that has a comma as separator. I know that I must user wc -w, but wc uses space as a separator

View 2 Replies View Related

General :: Removing The Comma From A Currency Entry?

Apr 24, 2010

I have a file of the formcol1, col2, $330,000, col4 ...col1, col2, col3, col4 ..col1, col2, $230,000, col4 ...The comma within the currency value causes the column to display unevenly when I open it so I want to remove it. I think I should be able to use the sed command but I am not sure extactly how. All the values have 3 digits after the $ and before the , so have triedsed -e 's/$[0-9]*,/ but I am not sure how to 'replaced with the string found just without the comma'So two guestions:1. Is this a good way to do it?2. How do I do it

View 8 Replies View Related

General :: Randomize The Comma Separated String In Shell?

Oct 10, 2010

I wanted to randomize the comma separated string.String like "test1,test34,test5,test6".And it would be displayed differently when I ran each time.

Expected output like "test5,test6,test1,test34".

View 13 Replies View Related

Fedora :: Adding A Line In Terminal To Try To Get Skype Working?

Sep 15, 2010

I was adding a line in terminal to try to get skype working and i added a line un-necessary and i need to edit the file. How do I either remove the file or edit it. It is a file in etc/yum.repos.d It says that it is read only, and i can't find how to change permissions.

View 2 Replies View Related

Fedora Installation :: Adding A Ɖ' To End Of Grub Line + Beta --> Production?

Nov 5, 2009

- Off a vanilla F11 livecd install, I stuck a 3 at the end of my grub line to boot into runlevel 3. I have been doing this for as long as I can remember (since Fedora 3). However now it seems to break and gives me a GRUB error. I press e to edit, and delete the 3. BUt it still throws and error?!?!?!?! Has this facility (ie sticking a number at the end of the grub line) been changed and why is my grub line now broken even though I've gone back and deleted the 3?

- If I install Fedora 12 beta now, will yum take me all the way into production when it goes live (assuming no killer bugs encountered), I'm guessing thats a yes?

View 4 Replies View Related

Fedora :: Adding LibX11 Permanently To Linker Command Line

Mar 15, 2011

I've been compiling a lot of games recently and most of them requires me to add libX11 to the linker command line. I can't think of nothing but to take a look at the Makefile and add -lX11. It works, but now, I'm compiling from a git repo, and I know the change will removed once I update the my working copy.To make it short, is it possible to add libX11 permanently to the linker command line?

View 7 Replies View Related

Software :: Adding Programs To Gnome Tool Bar From Command Line?

Oct 23, 2009

I'm trying to create a liveCD/USB for use of myself and my family. The idea is to set up the LiveCD to look like their used to seeing it. I know I can just copy the homedirectory but I wanted to do it via script so new user accounts could also have the common bells and whistles we use.So really I have two questions.1. Is it possible to add programs to the Gnome Tool Bar from command line? aka via a script2. Is it possible to modify the default panel template so new users get my changes?

View 1 Replies View Related

Programming :: Adding Number And String To Each Line In Data File

Apr 10, 2010

I have a very large data file, with 3 numbers in each line, ex. 3 4 5 ; 6 7 8.I want to add two numbers (0 and 1) at the end of every line, and a string at the beginning of the line. Does anyone know a efficient way to do so?

View 7 Replies View Related

Fedora :: Adding Variable Command Line Parameters To Desktop Launchers?

Mar 15, 2010

I have added an application launcher to my desktop and it works fine. However, I want to be able to feed parameters to the launcher before I launch the application. So, for instance, if the command is normally "/usr/bin/foo something" I want to be able to add the "something" parameter dynamically after clicking the launcher but before the application launches. Is this possible in Fedora?

View 2 Replies View Related

Ubuntu :: Adding A Line To Sudoers File So That Every User Can Run A Particular Program As Root?

Mar 27, 2010

is it possible to do so? I mean, I want every user to be able to run '/bin/x' for example, as root without entering a password. I know the security risks, but I'm trying this in a risk-free environment which security does not matter very much.

View 2 Replies View Related

Programming :: Php Explode By Comma Unless?

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

Ubuntu :: Extract Only The Strings After The Comma?

Jun 1, 2010

I have a csv file in this format:

Code:
1,characterswithnospace
2,same
4545,characters
I want to extract only the strings after the comma,

View 4 Replies View Related

Programming :: Pyqt3 List Without Comma ?

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

Programming :: Add Comma To End Of Lines In Text File?

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

Programming :: Concatenate The Output To Comma Delimited?

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

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 View Related

Programming :: Converting Date Format In A Comma Separated Field?

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

General :: Create Cron Tab When DSL Line Down Set Automatically Restart The Network Service While DSL Line Up?

Oct 7, 2010

How to create cron tab when DSL line down set automatically restart the network service while DSL line up?

View 3 Replies View Related

General :: Getting The Line Of String From Previous Pipe Output By Line Number?

Feb 8, 2010

After running the following command, I get:

[root@yukiko /]# find / -iname .bashrc
/home/clamav/.bashrc
/home/vpopmail/.bashrc
/etc/skel/.bashrc
/root/.bashrc

But I would like to have a command that prints a specific line by supplying the command with the line number, for example:

[root@yukiko /]# find / -iname .bashrc | getline(2)
/home/vpopmail/.bashrc

Is there such a command on CentOS?

View 3 Replies View Related

General :: Script To Count # Of Chars Per Line - If Line Meets Certain Criteria - And Get Avg #?

Sep 11, 2009

I have several files with many lines something like this:

I'm trying to write a script that will count the number of characters per line that doesn't contain a ">" symbol and give me an average of those values. I have most of the script together but I can't figure out how to connect some of the steps.

Code:

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved