String manipulation: extracting a part of a string, text replacement, formatting to a given width, etc.

learn more… | top users | synonyms

1
vote
3answers
71 views

Extract filename from another filename

I receive notification files for different files. I want to extract the filename from these notification files which I would use in another process. The first 4 strings of the notification file will ...
1
vote
2answers
26 views

How prepend appropriate amount of 0's to numbers contained in image names?

I've got a folder /User/me/Desktop/folder/images with files like key 1--name.jpg, key 10--name1.jpg, etc. The files are sorted incorrectly when fed to my site so I get an arrangement like key 84--name....
-3
votes
2answers
30 views

How can I reformat MAC address and IP pairs, ensuring each byte of the MAC has a leading zero?

I've got a table like this: 10.6.6.12 0:50:56:9b:a6:2 10.6.6.13 fe:9:31:b6:71:1d I must have something like this: 10.6.6.12,00:50:56:9b:a6:02 10.6.6.13,fe:09:31:b6:71:1d A 0 is always added ...
0
votes
1answer
47 views

copy lines of text between two files using string matches

Looking for some help, I have two files, one is a large list of various names the other is coordinates. both files start each line with an 8 digit code. I want to lookup 8 digit line code from File1 ...
0
votes
1answer
51 views

Issues with storing an echo of a date conversion into a string variable inunix

Apologies but this question comes from a question previously raised: How can I convert a local date-time into UTC date-time? Toby has been absolutely great helping me with some conversion string-->BST ...
0
votes
1answer
117 views

Find part of String and replace entire string in a file

I have a file named A.xml which contains a strings such as "Ticket_Release1" and "Ticket_V2". I want to find and replace all the strings in the file starting with Ticket_ with something called ...
0
votes
1answer
132 views

replacing multi line string with another multi line string using sed

for eg. input : // copyright package com.base import com.base import com.base ... i want to replace the pattern "// copyright\n\n^package.*" with another string i'm trying to do using sed -e '...
0
votes
1answer
227 views

Reading a string till a key word and replacing from there with another string

I am new to UNIX and am practising shell scripting. I have an application where I need string searching and replacement. There are some lines in a file 1 and file 2. I have a search key word. If the ...
0
votes
1answer
113 views

Finding words with one vowel group

I am trying to use a command to find all words in a list of words with one group vowels. Like four, for and far, but also words like ore and or. What I got so far: grep -i ^[qwrtypsdfghjklzxcvbnm]*[...
-1
votes
1answer
39 views

Extract string from first character till string pattern

I have a implicit file with **$&*#@** as field delimiter and **$#@&*** as record delimiter. Below is an example, 100$&*#@200$&*#@50$&*#@Some String$&*#@2016-01-01 101010$#@&...
2
votes
0answers
45 views

put string to commandline

I am making a bashfunction that show a menu binded to pgdown to browse through a a window which list my history (like 4dos/4nt etcetera). I have made so one line is always highlighted. $pos is ...
2
votes
0answers
128 views

Generate array of strings combined with number

I would like to generate a local array in a shell/bash script that consists of the following elements: JF-1998, JF-1999, JF-2000,... , JF-2011. That is, a string JF- combined with the years from 1998 ...
2
votes
0answers
160 views

Automatic replacement of strings in gedit

I want to replace some strings defined by me in gedit, after a word has been completed and/or the document has been saved. For example \├░rac should be replaced with \frac How do I do this in gedit or ...
1
vote
0answers
51 views

How to extract weather data from a html doc using linux string manipulation

I need to extract these info from this weather forecast site, but I don't know how much about string manipulation in linux: acm_RecentLocationsCarousel.push({name:"Irvine, CA", daypart:'day', ...
0
votes
0answers
26 views

Problem matching strings in bash script

I`m making a script to rename files in a folder. The new name for the files is in a config file. I have to be sure that the file I want to rename corresponds to the current one in the config file. My ...
0
votes
0answers
45 views

Subtract a Number from variable which contains a sentence

This is extended question from http://stackoverflow.com/questions/32081168/reading-a-log-file-with-different-sequences-using-shell-script I'm new to shell. I've written a shell script a code with ...
0
votes
0answers
78 views

Concatenating two strings cuts string

I extract two numerical strings from a textfile and and want to combine them to create a new string. The new string will be a filename. This is the textfile dates.dat: 378464,2015-01-31 1019348,2015-...