Fedora :: Strip Current Date With SED?

Nov 9, 2009

I have some text based reports in which I would like to strip the "Current Date" from and replace with equivalent number of empty spaces, for every occurrence.For example, here is what I need to strip:

Date: 11/09/09

If I manually run the following SED command, it works great, however I cannot seem to find a way to use the actual "date" command within SED, to get the desired results.

WORKING: sed -i -e 's/Date: 11/09/09/ /' myfile

I've been messing around with various attempts to do this using the "date" command within SED, but I just can seem to get it right. I've also attempted defining variables which call separate "date" commands for day, month, year and inject them via standard variable calling, echoing variable, expanding variable with brackets, etc... Here are a few of the SED command attempts I've tried:

Quote:

sed -i -e 'sate: `date +%D`: :' myfile
sed -i -e "s/Date: `date +%d`/`date +%m`/`date +%y`/ /" myfile
sed -i -e 's/Date: `date +%d`/`date +%m`/`date +%y`/ /' myfile
sed -i -e 's/Date: $(date +%D) / /' myfile

I need to replace it with the equivalent number of spaces, as I'm going to be overlaying a PCL Logo here and need to keep the structure of the rest of the file. Cannot have the remaining portion of the line shifting left.

View 5 Replies


ADVERTISEMENT

General :: Date - How To Set Current Time

Jun 26, 2011

Why is the output of the following commands different?

root@vmi2115:/var# hwclock
Sun 26 Jun 2011 01:21:38 PM CEST -0.273230 seconds
root@vmi2495:/var# date
Sun Jun 26 15:21:39 CEST 2011
root@vmi2115:/var#

And can I change the current time on Linux?

View 4 Replies View Related

General :: How To Add 5 Years To Current Date

Mar 17, 2010

I am using Red hat Linux operating system.I want change the date exactly 5 years ago to current date with out providing month, date and time. I want only the year should be 5 years ago .please help in this regard . example . If current date is this = Wed mar 18 22:59:23 IST 2010. past date shuld be like this= Sat Mar 18 22:59:23 IST 2005

View 6 Replies View Related

Software :: How To Get Current Date Log Files

Mar 13, 2011

Currently I'm using `ls -l | grep "Mar 13" ` for listing today log files.Output :-rw------- 1 root root 2188192 Mar 13 10:33 audit.logBut my requirement like below,note permission,date,size...audit.log Note : Where 10 logs file are same directory in different date , But I'm looking files which are logging in today date (Mar 13)

View 2 Replies View Related

Networking :: Put Current Date And Time On My Machine From Certain URL?

Dec 7, 2010

I am using the Terminal. I would like to know how do I put the current date and time on my machine and the date from a certain URL that has .php extension into a file.

View 3 Replies View Related

Ubuntu :: Show Current Date And Time In Screen Saver

Jan 20, 2011

[URL] While I could follow it: For what I am trying to do, it did not work. how to get it working?

View 8 Replies View Related

SUSE :: Determine The Report File Name Based On The Source Directory Name And Current Date?

Apr 17, 2010

### TO DO: Determine the report file name based on the source directory name and current date### The report name and thumbnail directory must follow this pattern: source-%j-%H### for example, for pictures in /home/you/pictures, the file name will be: pictures-%j-%H### HINT: Use sed to extract the directory name from the path and combine it with date command output

View 1 Replies View Related

Ubuntu :: Strip Down A 9.10 Installation?

Jan 7, 2010

I'm trying to strip down a 9.10 installation, which is destined to sit in the attic and act as a file/download server. Using Webmin (which is the greatest thing I have seen on Ubuntu, it rocks) I notice that the BIND process is using 5MB of memory, on an idle machine. Do I need this installed on a desktop machine ? Can folks suggest anything else I can disable/uninstall for a machine. I'm using neatx to connect to it, and Vuze as a torrent client.

View 3 Replies View Related

Ubuntu Multimedia :: Replace Jpg Files Last Modification Date With Timestamp Creation Date?

Sep 22, 2010

I'm looking for a method for modifying some jpg photo files last modification date with the corresponding timestamp creation date of each file.The reason is that shotwell import pictures in folders according to last modification date which is stupid on my opinion.

View 2 Replies View Related

Ubuntu :: Organize Folder With Images By Date Taken Rather Than Date Edited?

Aug 1, 2011

As a photographer I'm constantly taking photos and storing them in folders. Now occasionally I'm using two cameras (either for different settings or an assistant is also taking photos) which means that for one event I can have differently named images.Both cameras have the same time set (which always helps in Windows) but in Ubuntu when trying to sort my folder by date taken I can't.The options I'm given are to sort them: Manually, by Name, by Size, by Type, by Modification date and by Emblem.Now none of those are helpful to me once I've done a few edits to the images.So please if anyone knows, how do you organise a folder with images taken on different cameras by Date Taken rather than Date Edited?

View 3 Replies View Related

General :: Use Date With Touch To Create New File With Date Based Name?

Mar 12, 2010

I am using CRON to create a new, blank file, every minute, in a specific location on my web server. After web searching, and reading man pages, I get the impression that the following command is supposed to work:touch /home/mydomain/var/folder/attachments/`date +%H%M`.txtThis should give me a new file with a file name that is the current hour and minute.However, when executed, the CRON mailer reports:touch /home/mydomain/var/folder/attachments/`date +/bin/sh: -c: line 0: unexpected EOF while looking for matching /bin/sh: -c: line 1: syntax error: unexpected end of fileSo, it looks like shell is seeing the plus (+) sign as an EOFObviously, nothing get created.What would be the easiest, single line command to create an empty file, at a given location, with a time based file name

View 5 Replies View Related

General :: Julian Date Converter To Gregorian Date

Apr 22, 2010

Anyone have a ksh solution to convert julian date to gregorian date?

View 6 Replies View Related

OpenSUSE Install :: Strip Out The # On The CLI Text Editor?

Mar 7, 2011

how can i strip out the # command in CLI on openSUSE? or the exact way of this command in ubuntu

sh -c "grep -v -e '^#' /etc/squid/squid.conf.backup | cat -s > /etc/squid/squid.conf"

View 6 Replies View Related

Software :: Imagemagick++ - How To Achieve Strip In C++ Code

Jan 27, 2011

when i use image magick...in command, use -strip, can remove image's verbose but c++ code, how can i do?

View 1 Replies View Related

OpenSUSE :: Comic Strip Widget Is Too Small To Read?

Apr 5, 2010

I'm having some difficulties with the comic strip widget that I use to keep me updated on Dilbert. It started out in ok-ish size, a little small, but readable. Now the entire strip takes up 3x3 cm, totally unreadable. Is there anyway to fix that?

Here is a screeshot of it:

[URL]

View 3 Replies View Related

General :: How To Strip/trim Characters In Command Line

Mar 23, 2011

I have a bunch of files (around 900) that have some special characters. Some of the files contains example, and quoting "[useless] filename (something)"so what I want is just to strip the brackets and parenthesis, some are folders, others are text files

View 1 Replies View Related

General :: Should Jpegtran Remove More Bytes Than Mogrify Strip

Aug 23, 2011

I'm currently using mogrify -strip image.jpg to remove unwanted bytes from images, it was suggested I could remove further data by using jpegran from libjpeg, something like:

jpegtran -copy none -optimize -outfile image.jpg image.jpg

The problem I'm having - if it even is a problem - is that jpegtran doesn't seem to actually do anything that mogrify isn't already doing. In all my testing the filesize just stays the same. If I remove the mogrify part of my code and replace with jpegtran then it seems to perform the same function.

For example:

image without compression: 300k
image with mogrify -strip + jpegtran: 272k
image with mogrify -strip only: 272k
image with jpegtran only: 272k

I was under the impression though that mogrify just removed image profiles/comments and that jpegtran did this as well as losslessly compressing the image to make it smaller. Am I missing something?

View 1 Replies View Related

Ubuntu :: Strip Lucid Desktop Installation To MinimalCD?

Sep 6, 2010

I'm trying to get a minimalCD installation on a flashdrive but the installation never finishes... (i've left the installation runnin overnight for over 12hrs and only 90 percent got completed; whenever trying to retrive packages from the internet the process slows down to a crawl; i've tried ext4, ext3, ext2 and resierfs)normal Desktop insatallation works fine; so I was wondering if there is anyway to strip all the packages off a normal installation to get it to minimal installation, and than start installing the pacakges i need?

View 4 Replies View Related

Ubuntu :: Wide Black Strip In Firefox Blinks On And Off

Nov 18, 2010

If I click the mouse anywhere inside firefox browser window I get a big black strip and it blink on and off. See screen shot.Screenshot-Navigating and Working in Scribus | Linux Journal - Mozilla Firefox.jpg.I can get it to stop by doing a page reload. But it is very annoying. Has this happen to anyone else? If it has has anyone found a fix for this? While I was typing this it happen again.Screenshot.jpg

View 1 Replies View Related

Ubuntu :: Access Menu Strip When Not In Full Screen?

Aug 22, 2011

I've noticed in Ubuntu that a lot of applications like to make use of the strip of menus that go at the top of the screen; I think it's called a menu strip in Visual Studios.Anyways, the only way I can see it (that I've figured out thus far) is to drag the window to the top of my screen, thus maximizing it, then use the menu, and put it back.What I want is a less... tedious way of accessing those commands, preferably without changing my window position. Is there a trick to it? In windows, unlike Ubuntu, that strip is available regardless of window size; is there a reason it disappears in my Ubuntu?

View 1 Replies View Related

Software :: Using SED To Strip Multiple Leading Hash Symbols From A File?

Oct 28, 2010

I have a quirky situation whereby I'm using SED to selectively comment out a line in a crontab job (on Solaris, I know but it's connected to the Linux function I'm working with).

What's happening is this.

Remove hash symbol

Code:
/opt/csw/bin/gsed -i '/^.*/usr/local/scripts/mirror-fix.sh.*/ s/^#//' $TEMPFILE
Restore hash symbol

Code:
/opt/csw/bin/gsed -i '/^.*/usr/local/scripts/mirror-fix.sh.*/ s/^/#/' $TEMPFILE

The problem I'm running into is that the script can sometimes prepend an extra hash # symbol if run more than once (I have a lockfile that I poll for to discourage this, but that's not perfect).

I wonder how I can modify that sed statement to remove any/all leading hash marks up to the first other character, in this case it's a 0 (zero) which is a crontab file.

View 8 Replies View Related

Slackware :: Dhclient Does Not Strip Or Escape Shell Meta-characters

Apr 6, 2011

dhclient does not strip or escape shell meta-characters

Summary: dhclient doesn't strip or escape certain shell meta-characters in dhcpd responses, allowing a rogue server or party with with escalated privileges on the server to cause remote code execution on the client.

CVE:

ISC dhclient did not strip or escape certain shell meta-characters in responses from the dhcp server (like hostname) before passing the responses on to dhclient-script. Depending on the script and OS, this can result in execution of exploit code on the client.

CVSS Score:

For more information on CVSS scores, visit [url]

Workarounds:

On SUSE systems, it is possible to disable hostname update by setting DHCLIENT_SET_HOSTNAME="no" in /etc/sysconfig/network/dhcp.

Other systems may add following line to dhclient-script at the beginning of the set_hostname() function:

In environments where filters/acls can be put into place to limit clients to accessing only legitimate dhcp servers, this will protect clients from rogue dhcp servers deliberately trying to exploit this bug.

However, this will not protect from compromised servers.

Active exploits:

Solution:

Upgrade to 3.1-ESV-R1, 4.1-ESV-R2 or 4.2.1-P1. [url]

No patch is available for 4.0.x as it is EOL. Anyone running 4.1.x should upgrade to 4.1-ESV-R2.

Acknowledgments:

Revisions:

View 1 Replies View Related

Ubuntu :: Change The Window Scrollbars In 11.04 From The Frankly Annoying Minimalist Orange Strip?

Apr 30, 2011

Is there any way to change the window scrollbars in 11.04 from the frankly annoying minimalist orange strip to the far more user friendly large bar with clickable arrows top and bottom?

I'm using Ubuntu Classic Desktop...if I really couldn't get on with this scrollbar...would I actually have to go back to the previous OS release?

View 1 Replies View Related

OpenSUSE Install :: Green With White Veins In Background - Strip Of Black Running Horizontally

Dec 10, 2009

I can configure my software's appearance? Well, for the KDM theme, the Grub Bootsplash, i can download themes people so generously create. I however, desire the BOOTSPLASH. or whatever it is, of openSUSE 11.1. the green with white veins in the background, and a strip of black running horizontally across, with "openSUSE" written on it in white. i mean the one that masks the initial Text interface, the FIRST GUI you see after GRUB. The one that also shows when you power down. Is this a plausible endevour? I do have my 11.1 iso, in case it's stored as a theme in there.

View 6 Replies View Related

Red Hat / Fedora :: Anyone Know The Path To DATE

May 24, 2010

What is the path to date?

I can't remember and can't find it anywhere with google or with the search here.

View 2 Replies View Related

Fedora :: Create Filenames Using The Date

May 5, 2010

I am currently working on a script which makes regular backups of some data I have, and I would like to name the compressed TAR files with the date it they were created, in short I want to rename a file:

OriginalName.tar.gz --> AnotherName-30-05-2010.tar.gz

Is there an easy way I can accomplish that? How?

View 14 Replies View Related

Fedora :: Keep Wine Up To Date Easily?

May 26, 2010

Is there any easy way to do this from within yum? Maybe by enabling a repository for that file or some such? Would like to keep up to date with wine releases.

View 4 Replies View Related

Fedora :: Date Format In Dolphin

Aug 18, 2011

I have Fedora 15, with gnome and KDE core because I want to use Dolphin. The language of the OS is English so it shows dates in mm/dd/yyyy format. How can I get it to show dd/mm/yyyy or another format?

View 9 Replies View Related

Ubuntu Multimedia :: Digikam - Renaming On Import - "Create Date" Versus "File Modification Date"

Jan 24, 2011

I just switched from a basic digital camera to a more advanced one that stores both Jpeg and Raw (.Nef - it's a Nikon) files for me.When importing files in Digikam, I rename the files so that they start with Date and Time. Example: 20110121-223748.JPG for a photo taken on Jan 21st 2011 at 22:37:48.I was a bit surprised when importing both the JPEG and the Raw version of the same photo, that the filename is different by a few seconds (no constant offset, sometimes they are the same):

20110121-223748.JPG
20110121-223750.NEF

I did some "research" by looking at the exif data of both files (using "exiftool 20110121-223748.JPG" from the command line). Here is what I got back

(amongst other data):20110121-223748.JPG
File Modification Date/Time : 2011:01:21 22:37:48+01:00
Modify Date : 2011:01:21 22:37:48
Date/Time Original : 2011:01:21 22:37:48

[code]....

So it seems that Digikam is using the "File Modification Date/Time" (different in the Jpeg's and Raw's of my camera) rather than the "Create Date" (the same for both Jpeg and Raw). (The few seconds difference in "File Modification Date/Time" between the two versions of the same photo is probably due to the time that my camera needs to write away the data on the SD memory card. I guess.) Is there a way to have Digikam use the Create Date? (Or the Date/Time Original?)

PS: I'm on Ubuntu 10.04LTS, using DigiKam 1.2.0

View 1 Replies View Related

Fedora :: Rename JPG Files To Creation Date

Sep 2, 2009

I have a list of .jpg files from two cellphones that I would like to rename to the file creation date... but so far I can't seem to find a suitable script (or anything remotely close to what I need).

These are jpg's snapped on cellphone cameras, so no EXIF data exists.

View 4 Replies View Related







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