Search Results

Search found 10355 results on 415 pages for 'shell extension'.

Page 30/415 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Explained shell statement

    - by Mats Stijlaart
    The following statement will remove line numbers in a txt file: cat withLineNumbers.txt | sed 's/^.......//' >> withoutLineNumbers.txt The input file is created with the following statement (this one i understand): nl -ba input.txt >> withLineNumbers.txt I know the functionality of cat and i know the output is written to the 'withoutLineNumbers.txt' file. But the part of '| sed 's/^.......//'' is not really clear to me. Thanks for your time.

    Read the article

  • shell script filter du and find by a string inside a file in a subfolder

    - by Jason
    I have the following command that I run on cygwin: find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | xargs du --max-depth=0 > foldersizesreport.csv I intended to do the following with this command: for each folder under /d/tmp/ that was modified in last 150 days, check its total size including files within it and report it to file foldersizesreport.csv however that is now not good enough for me, as it turns out inside each /d/tmp/subfolder1/somefile.properties /d/tmp/subfolder2/somefile.properties /d/tmp/subfolder3/somefile.properties /d/tmp/subfolder4/somefile.properties so as you see inside each subfolderX there is a file named somefile.properties inside it there is a property SOMEPROPKEY=3808612800100 (among other properties) this is the time in millisecond, i need to change the command so that instead of -mtime -150 it will include in the whole calculation only subfolderX that has a file inside them somefile.properties where the SOMEPROPKEY=3808612800100 is the time in millisecond in future, if the value SOMEPROPKEY=23948948 is in past then dont at all include the folder in the foldersizesreport.csv because its not relevant to me. so the result report should be looking like: /d/tmp/,subfolder1,<itssizein KB> /d/tmp/,subfolder2,<itssizein KB> and if subfolder3 had a SOMEPROPKEY=34243234 (time in ms in past) then it would not be in that csv file. so basically I'm looking for: find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | <only subfolders that have in them property in file SOMEPROPKEY=28374874827 - time in ms in future and not in past | xargs du --max-depth=0 > foldersizesreport.csv

    Read the article

  • Sum in shell script

    - by Dinis Monteiro
    Why can't I create a sum of total words in this script? I get the result something like: 120+130 but it isn't 250 (as I expected)! Is there any reason? #!/bin/bash while [ -z "$count" ] ; do echo -e "request :: please enter file name " echo -e "\n\tfile one : \c" read count itself=counter.sh countWords=`wc -w $count |cut -d ' ' -f 1` countLines=`wc -l $count |cut -d ' ' -f 1` countWords_=`wc -w $itself |cut -d ' ' -f 1` echo "Number of lines: " $countLines echo "Number of words: " $countWords echo "Number of words -script: " $countWords_ echo "Number of words -total " $countWords+$countWords_ done if [ ! -e $count ] ; then echo -e "error :: file one $count doesn't exist. can't proceed." read empty exit 1 fi

    Read the article

  • BASH SHELL IF ELSE run command in background

    - by bikerben
    I have used the & command before to make a script run another script in the background like so: #!/bin/bash echo "Hello World" script1.sh & script2.sh & echo "Please wait..." But lets say I have another script with an IF ELSE statment and I would like to set an ELIF statement mid flow as a background task witht the & and then carry on with processing the rest of my script knowing that while rest of the ELIF will carry running in the back ground: #!/bin/bash if cond1; then stuff sleep 10 & stuff stuff elif cond2; then something else else echo "foo" fi stuff echo "Hello World" I really hope this makes sense any help would be greatly appreciated.

    Read the article

  • Shell Script - print selected columns

    - by teepusink
    Hi, I have a txt file with columns separated by tabs and based on that file, I want to create a new file that only contains information from some of the columns. This is what I have now awk '{ print $1, $5 }' filename newfilename That works except that when column 5 contains spaces e.g 123 Street, only 123 shows up and the street is considered as another column. How can I achieve what I'm trying to do? Thanks, Tee

    Read the article

  • Shell Script- each unique user

    - by Dinis Monteiro
    Hi guys I need "for each unique user, report which group they are a member of and when they last logged in" so i have: #!/bin/sh echo "Your initial login:" who | cut -d' ' -f1 | sort | uniq echo "Now is logged:" whoami echo "Group ID:" id -G $whoami case $1 in "-l") last -Fn 10 | tr -s " " ;; *) last -Fn 10 | tr -s " " | egrep -v '(^reboot)|(^$)|(^wtmp a)|(^ftp)' | cut -d" " -f1,5,7 | sort -uM | uniq -c esac My question is: how i can show the each unique user? the script above only show the more recent user logged in the system, but i need all unique users. anyone can help? thanks

    Read the article

  • How to use a string as a delimiter shell script

    - by Dan
    I am reading a line and am using regex to match it in my script. (/bin/bash) echo $line | grep -E '[Ss][Uu][Bb][Jj][Ee][Cc][Tt]: [Hh][Ee][Ll][Pp]' > /dev/null 2>&1 if [[ $? = "0" && -z $subject ]]; then subject=`echo $line | cut -d: -f2` > /dev/null echo "Was able to grab a SUBJECT $line and the actual subject is -> $subject" >> $logfile fi now my problem is that i use the colon as the delimiter. but sometimes the email will have multiple colons in the subject and so I am not able to grab the whole subject because of that. I am looking for a way to grab everything after the colon following subject. even is there is a way to loop through and check for a colon or what. maybe cut allows you to cut with a string as delimiter? Not sure...any ideas? Thanks!

    Read the article

  • Redirect output of shell script to a file

    - by Buzkie
    I'm trying to redirect the output of my script and it needs to be called inside the script. filename=uname -a filename="$filename" date 2>&1 | tee $filename".txt" That is what I have so far, but it's obviously wrong. I don't know too much SH scripting, so help is appreciated -Alex

    Read the article

  • Skipping a line and reading another line in shell script while loop

    - by parameswar
    i have a code which reads a file line by line using a while loop. Inside the while loop, i have certain conditions. Is there a way using which i can skip the current line and read the next line based upon the condition ? Let me be precise: while read Line do //some sample conditions a=$Line if [ "a" == "b" ] //i want to go to the next line from this point. done < **inputfile** Any help would be appreciated.

    Read the article

  • shell script stopped working --- need to rewrite?

    - by OopsForgotMyOtherUserName
    The script below worked on my Mac OS X. I'm now using Ubuntu OS, and the script is no longer working. I'm wondering if there's something that I need to change here? I did change the first line from #!/bin/bash to #!/bin/sh, but it's still throwing up an error.... Essentially, I get an error when I try to run it: Syntax error: end of file unexpected (expecting ")") #!/bin/sh REMOTE='ftp.example.com' USER='USERNAME' PASSWORD='PASSWORD' CMDFILE='/jtmp/rc.ftp' FTPLOG='/jtmp/ftplog' PATTERN='SampFile*' date > $FTPLOG rm $CMDFILE 2>/dev/null LISTING=$(ftp -in $REMOTE <<EOF user $USER $PASSWORD cd download ls $PATTERN quit EOF ) echo "open $REMOTE" >> $CMDFILE echo "user $USER $PASSWORD" >> $CMDFILE echo "verbose" >> $CMDFILE echo "bin" >> $CMDFILE echo "cd download" >> $CMDFILE for FILE in $LISTING do echo "get $FILE" >> $CMDFILE done echo "quit" >> $CMDFILE ftp -in < $CMDFILE >> $FTPLOG 2>&1 rm $CMDFILE

    Read the article

  • Chrome Extension - Dynamic Right-Click Menu

    - by user1277607
    I am trying to create an option in the right-click menu that is dynamic based on the user's action. If the user selects some text, then right-clicks, the option will say "Display It". If the user right-clicks without selecting some text, the option will say "Select Some Text First" and be grayed out. I am wondering how do I achieve this? I currently have it so that the option will appear only when the user has selected some text. I am unsure how to modify it to meet my second requirements. chrome.contextMenus.create ({ title:"Display It!", contexts:["selection"], onclick:function(info,tab) { chrome.tabs.sendRequest( tab.id, {callFunction: "displaySidebar", info: info}, function(response) {console.log(response);} ); } });

    Read the article

  • Shell complains 'cannot execute binary file'

    - by Negai
    Hi everyone, I've playing around with linux and noticed that for some mysterious reason commands like '/bin/sh ' just will not work. Each time I'm trying to start a process it yields 'cannot execute binary file' error message. m@sanctuary:~$ sh sed /bin/sed: /bin/sed: cannot execute binary file When I first launch sh and try to execute sed, it succeeds. I'm starting to loose my wits. It would be just great, if somebody could help me. Thank you.

    Read the article

  • chrome extension script is loading twice even more on some pages

    - by Youhan
    this is my background.js file chrome.tabs.onUpdated.addListener(function(tabId,info, tab) { var sites =new Array('site2','site1'); var url=tab.url; var siteFlag=0; for(var i in sites) { var regexp = new RegExp('.*' + sites[i] + '.*','i'); if (regexp.test(url)) {siteFlag=1;} }; if(siteFlag==1){ chrome.tabs.executeScript(tabId, {file:"contentscript.js"}); chrome.tabs.executeScript(tabId, {file:"jquery.js"}); chrome.tabs.insertCSS(tabId,{file:"box.css"}); } }); In the contentscript.js I simply run a popup box. $(document).ready(function () { function popup() {...} if (window.addEventListener) { window.addEventListener('load', popup(), false); } else if (window.attachEvent) { window.attachEvent('onload', popup()); } }); There are some pages that there are one popup-box and there are pages that two or even more what is the problem?

    Read the article

  • Shell Screen -X Stuff problems

    - by user1621988
    OPTIONS="java -Xms1024M -Xmx1024M -jar craftbukkit.jar" PROCESS=server01 screen -dmS $PROCESS $OPTIONS nogui # Starting the application screen -x $PROCESS -X stuff `printf "stop\r"` # Closing the application screen -x $PROCESS # Attaching to the terminal of the application Starting the application work fine, however I got problems with stuff 'printf "stop/r"' It seems not to work when I just start up, wait some time and then try to Stop it with command above. But the strange thing is, that IF I did screen -x $PROCESS and detach (ctrl-A & ctrl-D) and then I use the Stop command it does work. So is there a way around to stuff printf without -screen -x the $PROCESS? Thank You in Advance

    Read the article

  • Can a shell loop do this?

    - by helpwithshell
    Ive seen loops to unzip all zip files in a directory, however, before I run this, I would rather make sure what Im about to run will work right: for i in dir; do cd $i; unzip '*.zip'; rm -rf *.zip; cd ..; done Basically I want it to look at the output of "dir" see all the folders, for each directory cd into it, unzip all the zip archives, then remove them, then cd back and do it again until theres no more. Is this something I should do in a single command or should I consider doing this in perl?

    Read the article

  • Shell scripting and test expressions

    - by Paul
    Hi, I'm trying to test whether a directory path exists when a file is passed to my script. I use dirname to strip and save the path. I want my script to run only if the path exists. This is my attempt below. FILE=$1 DIRNAME=dirname $FILE if [ -z $DIRNAME ] ; then echo "Error no file path" exit 1 fi But this doesn't work. Actual when there is no file path dirname $FILE still returns "." to DIRNAME, i.e. this directory. So how do i distinguish between "." and "/bla/bla/bla". Thanks.

    Read the article

  • Select All in Javascript (Firefox extension) not working right

    - by leezer3
    I'm having some problems with a select all/ none function. (I didn't write it, I'm trying to fix it!) It currently looks like this: rsfindmod.SelAll = function(){ document.getElementById("ListBox").selectAll(); document.getElementById("ListBox").focus(); } It's being used on a dynamically generated set of links, so there's no set number of items in this listbox. This seems to work most of the time, but randomly it only selects those which are visible at the time. Scrolling the list or hitting the button again seems to normally make it work as expected. My first (Obvious?) thought was to replace the function entirely with the one from this link for testing: http://viralpatel.net/blogs/2009/06/listbox-select-all-move-left-right-up-down-javascript.html Trouble is that I can't get this one to work whatsoever! This gives me the error that listbox.options is not defined Any thoughts please? I'm by no means certain whether it's the original function at fault, or something in the generation of this listbox.

    Read the article

  • Shell script for generating HTML out put

    - by user1638016
    The following script is generating the desired out put but not redirecting the result to /home/myuser/slavedelay.html #!/bin/bash host=<ip> echo $host user=usr1 password=mypass threshold=300 statusok=OK statuscritical=CRITICAL for i in ert7 ert9 do echo "<html>" > /home/myuser/slavedelay.html if [ "$i" == "ert7" ]; then slvdelay=`mysql -u$user -p$password -h<ip> -S /backup/mysql/mysql.sock -e 'show slave status\G' | grep Seconds_Behind_Master | sed -e 's/ *Seconds_Behind_Master: //'` if [ $slvdelay -ge $threshold ]; then echo "<tr><td>$i</td><td>CRITICAL</td>" >> /home/myuser/slavedelay.html echo "<tr><td>$i</td><td>CRITICAL</td>" else echo "<tr><td>$i</td><td>OK</td>" >> /home/myuser/slavedelay.html echo "<tr><td>$i</td><td>OK</td>" fi fi done echo "</html>" >> /home/myuser/slavedelay.html If I cat the output file /home/myuser/slavedelay.html it gives. <html> </html> Execution result : sh slave_delay.sh <tr><td>sdb7</td><td>OK</td>

    Read the article

  • replace new lines with comas in shell

    - by mpapis
    I want to replace new lines in text with coma or space but do not change the last new line. I know of this question: How to replace new lines with tab characters - but it does produce an tab on end instead of new line. So far I have come with: awk 'NR>1{printf","} {printf $1} END{printf"\n"}' Is there an easier way to do this? This is not an assignment, I am just curious want to level up my scripting.

    Read the article

  • Send mass emails php (probably a shell question?)

    - by Rob
    I've got 80,000 users on my site and i've recently turned away from the forum script i've been using and built something very simple myself that works just as well (the forum script was too bloated and resource intensive for my simple site) The only thing i've lost is the ability to mass email all my members. So i'm looking to come up with a script to do it myself. After looking around (including questions on here) I decided using Swift Mailer would be a good idea. However i've been through all the documentation and can't see how to send say "100 at a time" and i'm not sure how to go about it. To put it simply. I have an admin panel with a form with two inputs "subject" and "message". When I click submit what is the safest way for me to send 80,000 emails without crashing my server or being marked as spam? I'm on quite a beefy dedicated server so don't have the problems associated with shared servers. Thanks in advance for any advice!

    Read the article

  • Programmatically add an ISAPI extension dll in IIS 7 using ADSI?

    - by fretje
    I apologize beforehand, this is a cross post of this SO question. I thought I'd ask it there first, but apparently it doesn't harvest any answers there. I hope it will get more attention here. When I have an answer somewhere, I'll delete the other one. I'm trying to programmatically add an ISAPI extension dll in IIS using ADSI. This has been working for ages on previous versions of IIS, but it seems to fail on IIS 7. I am using similar code like shown in this question: var web = GetObject("IIS://localhost/W3SVC/1/ROOT/specificVirtualDirectory"); var maps = web.ScriptMaps.toArray(); map[maps.length] = ".aaa,c:\\path\\to\\isapi\\extension.dll,1,GET,POST"; web.ScriptMaps = maps.asDictionary(); web.SetInfo(); After executing that code, I do see an "AboMapperCustom-12345678" entry for that specific dll in the "Handler mappings" of the specific virtual directory in which I added the script map. But when I try to use that extension in a browser, I always get HTTP Error 404.2 Not Found The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server. Even after adding an entry to allow that specific dll in the "ISAPI and CGI restrictions", I keep getting that error. To make it actually work, I first have to undo these steps (encountering the same issue like the OP of the question mentioned above: after deleting the script map entry from the IIS manager GUI, I also have to programmatically delete it using ADSI before it's actually gone from the metabase). And then manually add an entry like this: inetmgr - webserver - website - virtual directory - handler mappings - add script map... path = *.dll, executable = <path to dll>, name = <doesn't matter, but it's mandatory> click "yes" on the question "do you want to allow this ISAPI extension?" When I compare the 2 entries, they are exactly the same, except for the "Entry Type" which seems to be "Inherited" for the programmatically added one and "Local" for the one added manually. The strange thing is, even though it says "Inherited", I don't see it anywhere in IIS on a higher level. Where is it inheriting from? In my code, I do add the script map to the specific virtual directory so it should be "Local" as well. Maybe there is the problem, but I don't know how to add a "Local" Script Map using ADSI. I really would like to keep using the ADSI method, as otherwise I will have to use different methods in our setup when working with IIS 7 or previous versions, and I would like to avoid that. To recap: How can I programmatically add a script map entry and its companion CGI and ISAPI restrictions entry to IIS 7 using ADSI? Anybody who can shed some light on this? Any help appreciated.

    Read the article

  • OS X: How can I copy the shell path to clipboard?

    - by lexu
    When working with files on my mac I employ a mixed approach of shell/finder or keyboard/mouse, similar to working with 4NT and Explorer on Windows. One thing I use(d) extensively on Windows is to copy the path of the current directory to the clipboard. This is an extended feature of TakeCommand by JPSoft, on Windows. Is there a way to copy the current path from the bash shell to the mac's clipboard, so I can use it in 'file open' and/or similar dialogues?

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >