Search Results

Search found 490 results on 20 pages for 'awk'.

Page 13/20 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • $ON_USER returning root instead of $USER

    - by Nathanel Titane
    Hello everybody! With Natty coming out soon, I've been at work updating my deployment and self-config script to make my desktop on 11.04 run and look the way I want it to. One bummer is that dbus seems to have changed and does not permit, in the same manner Lucid and Maverick did, the authentication of the current user by terminal call using grep and cat. Ideally, to run the script, I would sudo -s and then launch it as # chmod +x install && ./install Instead of returning my user name.. it now returns root and applies changes to the root profile and aborts whenever paths do not correspond. Here is my script header: #!/bin/bash ON_USER=$(echo ~ | awk -F'/' '{ print $1 $2 $3 }' | sed 's/home//g') export $(grep -v "^#" ~/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0) if sudo -u $ON_USER test -z "$DBUS_SESSION_BUS_ADDRESS" ; then eval `sudo -u $ON_USER dbus-launch --sh-syntax --exit-with-session` fi RELEASE=$(lsb_release -cs) How could I make it return the actual user now that natty is coming? Thanks for the help

    Read the article

  • Not enough space left in the hard drive. How to proceed?

    - by jimbobjgr
    Where do I begin... I can hardly do anything on Ubuntu 12.04. I am very close to removing and returning to Windows. First I could not load it because the graphics appeared to be running low but somehow that stopped happening and I could log on. Now I can not download anything or I get this message Cannot write: No space left on device. I tried trouble shooting this issue but every time I try and fix the problem I am blocked by this message E: Write error - write (28: No space left on device) E: Can't mmap an empty file E: Failed to truncate file - ftruncate (9: Bad file descriptor) E: The package lists or status file could not be parsed or opened. $ OLD=$(ls -tr /boot/vmlinuz-* | head -n -2 | cut -d- -f2- | awk '{print "linux-image-" $0}') Ubuntu is also running incredibly slow and I cant get anything done! Please help this is driving me mad!

    Read the article

  • How to work around the home directory changing to /root when using sudo?

    - by Nathanel Titane
    Hello everybody! With Natty coming out soon, I've been at work updating my deployment and self-config script to make my desktop on 11.04 run and look the way I want it to. One bummer is that dbus seems to have changed and does not permit, in the same manner Lucid and Maverick did, the authentication of the current user by terminal call using grep and cat. Ideally, to run the script, I would sudo -s and then launch it as # chmod +x install && ./install Instead of returning my user name.. it now returns root and applies changes to the root profile and aborts whenever paths do not correspond. Here is my script header: #!/bin/bash ON_USER=$(echo ~ | awk -F'/' '{ print $1 $2 $3 }' | sed 's/home//g') export $(grep -v "^#" ~/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0) if sudo -u $ON_USER test -z "$DBUS_SESSION_BUS_ADDRESS" ; then eval `sudo -u $ON_USER dbus-launch --sh-syntax --exit-with-session` fi RELEASE=$(lsb_release -cs) How could I make it return the actual user now that natty is coming? Thanks for the help

    Read the article

  • using ubuntu command line to replace text in huge file

    - by user299331
    hi i have a huge xml file that i must work with. right now the file is only 1 line that contains about 2 million characters which represent 30,000 records. there are no carriage returns or linefeeds whatsoever. what i need to do is make each record on its own line. new records begin with "" and end with "". i've been looking around here and it seems the tools to use are: sed, tr or awk but i'm not sure which is most appropriate. i've tried this to no avail: tr '<ROW' '\012 <ROW' <source.xml |tee destination.xml above seems to output some pretty weird stuff so i must be way off here. maybe its that "<" character that is the problem?

    Read the article

  • Remove a line from a csv file bash, sed, bash

    - by S1syphus
    I'm looking for a way to remove lines within multiple csv files, in bash using sed, awk or anything appropriate where the file ends in 0. So there are multiple csv files, their format is: EXAMPLEfoo,60,6 EXAMPLEbar,30,10 EXAMPLElong,60,0 EXAMPLEcon,120,6 EXAMPLEdev,60,0 EXAMPLErandom,30,6 So the file will be amended to: EXAMPLEfoo,60,6 EXAMPLEbar,30,10 EXAMPLEcon,120,6 EXAMPLErandom,30,6 A problem which I can see arising is distinguishing between double digits that end in zero and 0 itself. So any ideas?

    Read the article

  • Convert 12-hour date/time to 24-hour date/time

    - by Patrick Cuff
    I have a tab delimited file where each record has a timestamp field in 12-hour format: mm/dd/yyyy hh:mm:ss [AM|PM]. I need to quickly convert these fields to 24-hour time: mm/dd/yyyy HH:mm:ss. What would be the best way to do this? I'm running on a Windows platform, but I have access to sed, awk, perl, python, and tcl in addition to the usual Windows tools.

    Read the article

  • How to count differences between two files on linux?

    - by Zsolt Botykai
    Hi all, I need to work with large files and must find differences between two. And I don't need the different bits, but the number of differences. For the differ rows I come up with diff --suppress-common-lines --speed-large-files -y File1 File2 | wc -l And it works, but is there a better way to do it? And how to count the exact number of differences (with standard tools like bash, diff, awk, sed some old version of perl)? Thanks in advance

    Read the article

  • Display contents of a file in the parent directory

    - by Sharjeel Sayed
    I have a command which lists Weblogic instances directories on a server.I want to display contents of a file in the parent directory of each directory listed. An additional feature would be to display the name of the file in addition to displaying the contents /usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | grep domain | awk -F'=' '{print $2}' | sed -e 's/weblogic.policy//' -e 's/security\///' | sort The output of the above command looks like this /opt/<some_directory>/<domain_name>/<app_name>/ /opt/<some_directory>/<domain_name>/<app_name>/ I want to cat a file somefile.cf in the directory

    Read the article

  • how to get ipaddress of my computer

    - by astha goyal
    hello i want to knw the ipaddress of my computer. /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' this command gives the ipaddress of my computer and print result on console but i want it in a varible sothat i can use it in my C program. How can i do that.

    Read the article

  • Parse string with bash and extract number

    - by cleg
    Hello I've got supervisor's status output, looking like this. frontend RUNNING pid 16652, uptime 2:11:17 nginx RUNNING pid 16651, uptime 2:11:17 redis RUNNING pid 16607, uptime 2:11:32 I need to extract nginx's PID. I've done it via grep -P command, but on remote machine grep is build without perl regular expression support. Looks like sed or awk is exactly what I need, but I don't familiar with them. Please help me to find a way how to do it, thanks in advance.

    Read the article

  • UNIX script to convert queries

    - by Harish
    I need a UNIX shell script to convert my queries from Java compatible to Oracle compatible format. ie. I have all the java compatible queries: java: SELECT a, b, c, d, e, f,g "+// "from test where year(timestamp)=year(today) and month(timestamp)=month(today) " +// "and day(timestamp)=2 and h='" + "W" + "'" Oracle SELECT a, b, c,d,e,f,g from test where year(timestamp)=year(today) and month(timestamp)=month(today) and day(timestamp)=2 and h='W' Is it possible using sed or awk?

    Read the article

  • what is the command in terminal to extract text from a file

    - by PRINCE EMMIT
    hey can any one tell me to write the command in terminal to extract text from a html file using tags like,,,,...etc.... -i am thinking of putting these tags in a text file... -then i wanna match the tags with the help of command of terminal... -then i have to put that into a dump file(text)... because...i wanna change the text with language preference.... i tried with awk script and egrep too....but i got poor result...

    Read the article

  • Need help again altering output of script

    - by Aaron
    wget --output-document=- http://runescape.com/title.ws 2>/dev/null \ | grep PlayerCount \ | head -1l \ | sed 's/^[^>]*>//' \ | sed "s/currently.*$/$(date '+%m\/%d\/%Y %H:%m:%S')/" \ | cut -d">" -f 3,4 \ | sed 's/<\/span>//' \ | awk '{print $3, $4, $1, $2}' Will output: 03/19/2012 18:03:58 123,822 people Would anyone be able to help me rewrite this so the output looks like: 03/19/2012 18:03:58,123822,people I need it this way because when I import it into googledocs, everything with a comma gets separated. Thanks if you help!

    Read the article

  • How to trim whitespace from bash variable?

    - by too much php
    I have a shell script with this code: var=`hg st -R "$path"` if [ -n "$var" ]; then echo $var fi But the conditional code always executes because hg st always prints at least one newline character. Is there a simple way to strip whitespace from $var (like trim() in php)? or Is there a standard way of dealing with this issue? I could use sed or awk, but I'd like to think there is a more elegant solution to this problem.

    Read the article

  • How to transform multiple line into one line in bash stdout ?

    - by Samantha
    Hello, I sometimes do this in my shell : sam@sam-laptop:~/shell$ ps aux | grep firefox | awk '{print $2}' 2681 2685 2689 4645 $ kill -9 2681 2685 2689 4645 Is there a way I can transform the multiple lines containing the PIDs into one line separated by spaces ? (It's a little bit annoying to type the PIDs every time and I really would like to learn :) ) Thanks a lot.

    Read the article

  • Bash: "xargs cat", adding newlines after each file

    - by NoozNooz42
    I'm using a few commands to cat a few files, like this: cat somefile | grep example | awk -F '"' '{ print $2 }' | xargs cat It nearly works, but my issue is that I'd like to add a newline after each file. Can this be done in a one liner? (surely I can create a new script or a function that does cat and then echo -n but I was wondering if this could be solved in another way)

    Read the article

  • how to get ip address of my computer

    - by asthagoyal
    hello i want to get ipaddress of my computer in variable ip thru this code but it assign nothing in ip char comm[100]; int s=0; char ip[100]; sprintf(comm,"export ip=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`"); s=system(comm); printf("\n ip is %s",ip);

    Read the article

  • Which quotes does a programmer need?

    - by Masi
    My keyboard only has normal quotes, not the smart ones. I have obversed that I need normal ones in cgi development and the backward ones in AWK/SED. Is there any rule when I should use smart quotes, normal ones and backward ones? Obviously, I need to edit my keyboard layout to get the smart quotes.

    Read the article

  • msys+mingw - is there installer or at least .tar.lzma/.zip?

    - by Maciej Piechotka
    I try to install n'th time the msys+mingw - however with little success. I need the minimal developer system (standard tools such as sed/awk+autotools+gcc) however each time something is not working (for example currently when I try to run autotools m4 goes into some error loop on AC_INIT). I know they stopped providing installer 'for easy update of components' and they are working on something but maybe there is something unofficial.

    Read the article

  • how to get list of databases that a user owns?

    - by chiggsy
    Id like to find out ( and delete ) all the databases owned by an owner in postgres 8.4.3 I'm new to postgres also, and although I can , and will , read the whole manual today i was forced to use for i in $(psql -l |grep novicedba | awk '{print $1}') psql -d postgres -c " drop database \"$i\"" out of desperation. What's the postgresql way to do this?

    Read the article

  • Trying to test for OS and space in filesystem on AIX

    - by Buzkie
    I need to check if I Filesystem exists, and if it does exist there is 300 MB of space in it. What I have so far: if [ "$(df -m /opt/IBM | grep -vE '^Filesystem' | awk '{print ($3)}')" < "300" ] then echo "not enough space in the target filesystem" exit 1 fi This throws an error. I don't really know what I'm doing in shell. Please help. -Alex

    Read the article

  • cygwin: svn does not work anymore

    - by mtim
    All of the sudden svn stopped working in cygwin installation on windows xp. when I execute svn binary, nothing happens, svn process does not even show up in the Task Manager. I've reinstalled svn but it did not help (the last resort would be to uninstall cygwin itself). Everything else in cygwin works fine: awk,python,sed,more,less,tail and etc. here is what is happening ... mt@s022 ~ $ which svn /usr/bin/svn mt@s022 ~ $ svn --version mt@s022 ~ $ svn status mt@s022 ~ $ svn info mt@s022 ~ $

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >