Results 1 to 3 of 3

Thread: How to change some text in a file.

  1. #1
    Join Date
    Jul 2006
    Location
    Lancashire
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    How to change some text in a file.

    Hi
    SMPlayer has a config file "smplayer.ini".
    Located here:-
    /home/user/.config/smplayer/smplayer.ini

    A copy is attached below.

    It stores the MPlayer version in the line:-
    "mplayer_detected_version=35691"

    This seems to be the MPlayer version that is detected when SMPlayer is first installed and the smplayer.ini file is created.

    When I update MPlayer, I edit this file manually to insert the new version.
    (So that the correct version appears in SMPlayer > Help > About SMPlayer screen).

    Is there a command I could use that will find the line that starts "mplayer_detected_version=" and change it to "mplayer_detected_version=$version"?



    PS
    version can be obtained from MPlayer SVN with a command like this:-
    Code:
    version=$(LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2)
    And maybe it can be obtained modifying a command like this:-
    Code:
    mplayer -h | grep -i "MPlayer SVN-r"
    Attached Files Attached Files
    Last edited by ron999; December 18th, 2012 at 03:38 AM.

  2. #2
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to change some text in a file.

    Code:
    sed -i "/mplayer_detected_version/ s/=.*$/=$version/" ~/.config/smplayer/smplayer.ini
    Last edited by Vaphell; December 18th, 2012 at 03:46 AM.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  3. #3
    Join Date
    Jul 2006
    Location
    Lancashire
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How to change some text in a file.

    Quote Originally Posted by Vaphell View Post
    Code:
    sed -i "/mplayer_detected_version/ s/=.*$/=$version/" ~/.config/smplayer/smplayer.ini
    That's done the job, thanks Vaphell.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •