Fedora :: Using Sed To Add Commas To New Lines
Dec 16, 2009
I have some data like below:
interface Vlan1
description Management LAN
interface Vlan41
description Somelan
interface Vlan65
description Some other lan.
service-policy input 2Mbps
service-policy output 2Mbps
How can I get sed to look at this txt file and add a comma at the beginning of every new line between the interface lines. i.e.:
interface Vlan1
,description Management LAN
interface Vlan41
,description Somelan
interface Vlan65
,description Some other lan.
,service-policy input 2Mbps
,service-policy output 2Mbps
View 2 Replies
ADVERTISEMENT
Nov 5, 2010
Using sed, I am trying to append four commas ',,,,' at the end of lines containing the pattern 'Response' in a text file with lines such as these:
6,Pulse,50,254968,14886,NA,,,,
7,Picture,8,265157,0,1,15045,2,0,15000
7,Response,1,271553,6396,1
7,Pulse,50,274969,9812,NA,,,,
8,Picture,1,290232,0,1,15045,2,0,15000
8,Pulse,50,294969,4737,NA,,,,
[Code].....
View 1 Replies
View Related
Jan 4, 2011
i want to find a command line way to edit a text file to delete all commas in the file. i do not want to replace them w/ anything.
View 2 Replies
View Related
Nov 4, 2010
I'm trying to write a bash script that has to extract values from a csv file. Problem is there are lines like this:a,b,c,"dd,dd,dd",e,f,gI'm using awk to extract the values but when I try it extract value 4 with awk I get:"ddinstead of:"dd,dd,dd"Does anyone know how to get awk to ignore commas within double quotes?
View 5 Replies
View Related
Sep 7, 2011
There are weird commas after the real-name parameter of some lines in my /etc/password file.
kye:x:1000:100:Kye,,,:/home/kye:/bin/bash
What gives? Why are they there? Can I remove them?
View 1 Replies
View Related
Jan 4, 2011
I wrote a hack script that outputs the following every so often: Code: 01/04/11 10:33:02: 97,1413,1447,2860 I must leave the data format the same --but I want a special number from it. In this case it's 97 and it's always going to be the first in the 4 columns of comma delimited items. I can extract with this:
Code: cat datafile | awk -F" " {'print $3'} | awk -F"," {'print $1'} But that's really sloppy. Can someone point out a better way of doing this (with awk) and tell me why?
View 3 Replies
View Related
Apr 22, 2011
I have been experiencing a problem where the screen loads and after initial first few lines breaks up into multiple repetitions of lines. Reloading helps but has to be repeated when pageing down. Mail is no problem; it is supplied by my network provider. OS is openSUSE 11.2 which I update when advised. Below is a sample from the error console:
[Code]...
View 1 Replies
View Related
May 31, 2011
I've just installed Kubuntu 11.04, switched on wobbly windows effect. It runs very smooth on my Nvidia GeForce 7600 GS with dual screen twinview turned on. However, I get these lines when I drag/move the window upwards - see screenshot:
View 6 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
Jan 26, 2010
I've come across an unusual requirement for a service in my Ubuntu system.Simply put, I need to find a way to search for all instances of a term in a file, delete lines containing containing that term, and delete four lines below each instance of that term. ither that, or copy the entirety of a file to a new file and skip over all lines containing the term plus four below it.This sounds kinda weird, I know. Without going too far into detail, I either have to change the logfile format for a server I'm running which is a huge pain in the butt, or I can just run a script to edit an HTML report generated from said logs. (Said report is really just for managers to peruse, and I like my log format, so I'm pursuing option 2.)
View 4 Replies
View Related
Jun 10, 2011
I have this file and i need a command to permanently add a line of code to the file and sort the file by ID. I was able to add a line with the echo command but its not permanent
Code: 111:Smith:Mary:Davison:Attorney
222:Stumblebum:Jason:Novi:Student
229:Esposito:Amy:Toronto:Artist
[code]....
View 3 Replies
View Related
May 31, 2011
I need to configure 60000 lines in iptables. I am using script to create a file and iptables-restore to configure them.
I am getting error on commit and I see that if the file size if larger than around 39000 it failed.
Is there a limit to number of lines in iptables ?
View 2 Replies
View Related
Dec 25, 2010
View the entire contents of the file / etc / passwd, showing first 10 lines of file / etc / group, 10 displayed the last line of the file / etc / group. And
- The total number of lines and characters in file pwd and grp
View 2 Replies
View Related
May 29, 2011
I have weird graphical glitches in Gnome 3. They appeared in RC3 and now appear in the final release, but they didn't appear in beta. Here's what they look like, there are horizontal white lines appearing in different places where they shouldn't appear:
[URL[
it can be a result of this bug:[URL] but my glitches look different than the ones in there.
I have a Mobility Radeon HD 5650 video card. Should I just update my system regularly and hope it gets fixed, or is there some way to fix it by tweaking some settings or stuff? Maybe by installing the official ATI drivers? I'm not sure, but I've read somewhere that the official drivers don't work well with Gnome 3, is that true?
View 9 Replies
View Related
Jan 9, 2009
Downloaded the F10 live CD. Booted to it, got past the white, blue, and dark blue loading bar then my screen would be covered in black and white lines. No sign of the GUI except for a mouse cursor. ctrl+alt+backspace would cause the display to blink off and then come back on to the same thing. ctrl+alt+f2 would bring me to a terminal, logged in as root, but from there I couldn't do anything. startx would tell me I had x running on another screen.
hitting tab when booting the livecd and adding "xdriver=vesa" and "nomodeset" to the boot line. That works. I get to the desktop at native res with desktop effects. Killer. I tried to install; install went flawless, rebooted to my HDD and the same issue, black and white bars. When booted to my HDD, however, ctrl+alt+f2 doesn't bring me to a terminal, it causes my monitor to go into sleep mode and my computer becomes unresponsive so I can't do anything from the command line.
Here's what I'm getting at : how do I get my installed version of F10 to do the "xdriver=vesa" and "nomodeset" args that the livecd can do?
My machine is a home built machine I bought off of a friend. P4 2.4 ghz, GB RAM, 2 80GB HDDs, Radeon x1600.
View 3 Replies
View Related
Jul 11, 2009
So, my second real attempt at getting the 64 bit F11 up and running. I just started adding stuff before all the updates. Crash. So, I'm in the post install phase. Before anything else I installled akmod-nvidia manually, rebooted, and I'm doing yum update right now. I'm hoping many dependencies are solved in the update. There are about 209 line items to update after the initial install. Been updated all afternoon.
So, after the updates are done, I'm heading over to download the different repos I need for the fun stuff. Did you know Java is installed with this first yum update? Wasn't like that in F10. I think I tried 5 times on F10 before I got it right.
View 3 Replies
View Related
Nov 12, 2009
I've only seen this occur in cases where I'm viewing a GPG-signed message and a line wraps. A plus sign appears at the beginning of the next line. Is this something I can get rid of?
View 10 Replies
View Related
Nov 22, 2009
I noticed a problem when editing files with nano. This problem happens if the terminal window that I run nano from is not wide enough to show the full line.By way of example below is part of my grub.conf
Code:
title Fedora (2.6.31.5-127.fc12.x86_64)
root (hd0,13)
kernel /boot/vmlinuz-2.6.31.5-127.fc12.x86_64 ro root=UUID=47e4c448-8087-4ec6-a67b-814845a598db noiswmd LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us vga=0x370 nouveau.modeset=0
initrd /boot/initramfs-2.6.31.5-127.fc12.x86_64.img
If we assume the code box above is the size of the terminal window, if I edit anything past what will show as the $ sign in nano, it will automatically add a carriage return. So if we take the kernel line above, if say the screen shows at the end root=UUID=$, if say I were then to add 00 the end of the UUID, it will move everything starting from root=UUID= to a new line. Is there some wrap feature that is enable in Fedora for nano?
View 7 Replies
View Related
Apr 10, 2010
When I boot up F12, after I have decrypted the hard drives and after the services have started but before I get to the login screen my display flashes a series of interlaced lines across the screen. As far as i can tell theres no other problems with my computer, everything else seems to work fine. Its been there awhile now and its still there after a yum update. On first boot up of the day it shows white/gray lines (firstboot.jpg) [URL]. On subsequent shut down, boot ups it shows a blue, almost denim like display (shutdown.jpg) [URL]. Theres no problem if i just do a restart. Maybe related as well, last week some time my computer froze (opening large file, watching dvd and had firefox open, guess I ran out of memory?) So I did a reboot using the button on my computer, at the point where I usually get the coloured lines it instead showed a snapshot of my desktop just before it crashed. Though this happened after I first noticed the coloured lines.
View 4 Replies
View Related
Jan 24, 2011
installed fedora with the minimum option on the dvd. After that i logged it and im tring to install gnome, heres the catch though i only have 950MB worth of space. I noticed if i use the groupinstall "X Window System" it fails because of the space. Also it installs alot of things that I am not interested. what are the command lines to install gnome but with the minimal, no FF, no evolution, you get my point.
View 3 Replies
View Related
Oct 26, 2009
I have this massive table file with some data in it and I want to replace some lines that are wrong with the correct ones that are in another table file of the same format. The wrong lines are not all together in a block but randomly distributed so I need to make a loop checking if the line is in the other file and if it is, replace it. I want to try and do it with sed or awk but I don't really know how to....
View 12 Replies
View Related
Feb 10, 2009
I recently downloaded and installed Fedora 11 Alpha. I then installed the Nvidia drivers for my Graphics card (GeForce 7800 GTX). I discovered that Fedora 11 is using a Beta version of Xorg and an incompatible ABI. So, my drivers would not work with Fedora 11 without me dowgrading the Xorg server. I decided to reinstall Fedora 10 instead.
I started the install, and when the installation loaded the generic video drivers, my screen showed only a bunch of colored vertical lines. Fedora 10 doesn't allow me to install in text mode.
View 3 Replies
View Related
Mar 11, 2011
I've got an older graphics card I'm trying to use. It actually runs fine through the bios and even works when fedora is loading. But once fedora finishes loading half the screen turns into thousands of multicolored horizontal lines.
View 4 Replies
View Related
Oct 21, 2010
I was needing some help with a problem I have. I just installed Ubuntu 10.04 and I have two monitors connected. I also use windows on the same computer and both screens are perfect. Though when I boot into ubuntu and it's running my second monitor begins to show blue lines running down the screen. I haven't been able to find an answer to my problem yet. I have an Acer monitor.
View 1 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
Jul 15, 2011
I have a file with n number of lines where every 2 lines are grouped.
So I want to print the items in a line and the next line in a single line.
For example:
I can print the line and the adjacent together and print the required items like this:
But that's not the order I want. How can I get it printed like below:
View 1 Replies
View Related
Aug 5, 2010
when I run the following command:
awk -F, '{print $10 "," $5 "," $1 "," $3 "," $4 "}' myfile > tmpfile
tmpfile displays the lines but they are all cut off and placed on the line below at the same point.
View 1 Replies
View Related
Mar 5, 2011
I've a big text, and I would like to delete several lines in vim. I was thinking in doing that with marks, but I can't do it. Below it's an example text and I want to delete from <FROM HERE> to <TO HERE>. How can I do that?
[Quote] .....
View 3 Replies
View Related
Jan 19, 2010
I am trying to search for
Code:
<cats>
Sports
</cats>
how do i use the find command to search for <cats>Sports The problem here is that the word Sports is in the next line of <cats> so I cant use -
Code:
find /test/upload/ -type f -name "*.xml" -exec grep -l "<cats>Sports" {} ; -print
How do I put the next line string?
View 8 Replies
View Related
Nov 2, 2010
I have a file with a random word on each line (3k+ lines). How can I get the lines with only five characters? I tried using grep file | more, but it returns all the words (even those less than 5 characters).
Edit: I also tried grep '.{5}' file | more but it doesn't show anything. And grep '.{5}' file | more returns all lines with four or more characters (I'm really confused about why it's doing this).
View 4 Replies
View Related