Sponsored Content
Top Forums Shell Programming and Scripting Adding gaps to a string in bash Post 302882784 by kristinu on Thursday 9th of January 2014 06:51:13 AM
Old 01-09-2014
The sed is a good way. However things are not done yet

Code:
echo "$frmt_k1d1_test" | sed "s/.../&$gap/g"

which produces

Code:
%s            %s\    n

---------- Post updated at 06:51 AM ---------- Previous update was at 06:30 AM ----------

I think the best way is to search for 4 spaces, then replace with a string of size gap.
 

8 More Discussions You Might Find Interesting

1. Linux

Searching for gaps in huge (2.2G) log file?

I've got a 2.2 Gig syslog file from our Cisco firewall appliance. The problem is that we've been seeing gaps in the syslog for anywhere from 10 minutes to 2 hours. Currently I've just been using 'less' and paging through the file to see if I can find any noticeable gaps. Obviously this isn't the... (3 Replies)
Discussion started by: deckard
3 Replies

2. OS X (Apple)

Adding Color to bash

Hey everyone, I have come across an issue to where I am trying to create a script which changes the text color with a simple if then statement. I have seen it done with Fedora 8 but when I try and create it using my MacBook Pro running Snow Leopard it doesn't work. Funny thing is, when I use... (2 Replies)
Discussion started by: dachadster13
2 Replies

3. Shell Programming and Scripting

Searching for Gaps in Time

I am very new to shell scripting. We use C-Shell here and I know the issues that surround it. I hope a solution can be created using awk, sed, etc... instead of having to write a program. I have an input file that is sorted by date and time in ascending order ... (2 Replies)
Discussion started by: jclanc8
2 Replies

4. Shell Programming and Scripting

bash adding multiple names

Hi all, I make this bash script in which there is one option to add a name in txt file. So when I run the script it ask me for the name. When i enter the name, that name gets added in a txt file. If i add the same name again, the message comes up, the name is already there My question is..... (2 Replies)
Discussion started by: Learnerabc
2 Replies

5. Shell Programming and Scripting

Sorting and moving file sequence with gaps

Hello, I have lots of sequentially numbered files which make up an image sequence. I'm trying to do two things with it: #1: Find gaps in the sequence and move each range of sequencial files into their own subfolder. #2: Designate a starting point (file) and move every 24th file into... (4 Replies)
Discussion started by: ex_H
4 Replies

6. Shell Programming and Scripting

Adding Content to Variable (bash)

is this possible? its kind of like incrementing the value of a number in a variable. but in this case, instead of the value of the variable being a number, it's just contents/strings/characters/alpha-numeric etc. NOT a number. For instance: VAR=Tommy for all in $(blah blah) do ... (2 Replies)
Discussion started by: SkySmart
2 Replies

7. UNIX for Dummies Questions & Answers

Gaps and frequencies

I have this infile: >GHL8OVD01BNNCA Freq 10 TAGATGTGCCCGTGGGTTTCCCGTCAACACCGGATAGT-GCAGCA-TA >GHL8OVD01CMQVT Freq 1 TTGATGTCGTGGGTTTCCCGTCAACACCGGCAAATAGT-GCAGCA-TA >GHL8OVD01CMQVT Freq 1 TTGATGTGCCAGTTTCCCGTCTAGCAGCACTACCAGGACCTTCGC-TA >GHL8OVD01CMQVW Freq 1... (1 Reply)
Discussion started by: Xterra
1 Replies

8. UNIX for Beginners Questions & Answers

Escape bash-special character in a bash string

Hi, I am new in bash scripting. In my work, I provide support to several users and when I connect to their computers I use the same admin and password, so I am trying to create a script that will only ask me for the IP address and then connect to the computer without having me to type the user... (5 Replies)
Discussion started by: arcoa05
5 Replies
UPDATE-GAP-WORKSPACE(1) 					   User Commands					   UPDATE-GAP-WORKSPACE(1)

NAME
update-gap-workspace - manage a GAP workspace. SYNOPSIS
update-gap-workspace update-gap-workspace update Create or update the GAP workspace. update-gap-workspace delete Delete the GAP workspace. DESCRIPTION
At start up, GAP load all libraries and packages available on the system. This take several seconds. To save time, GAP can store the result of this initialisation in a `workspace'. update-gap-workspace help to manage such workspaces. update-gap-workspace can be run as root to manage the system-wide workspace. update-gap-workspace can be run as a normal user. In this case the workspace is stored in $HOME/gap/workspace.gz. Note that you need to rebuild the workspace each time GAP packages are added, removed or updated. To automate that task, if the system-wide workspace exists, it is automatically updated whenever a GAP-related Debian package is installed or upgraded. The gap script will automatically load such workspace at start up. FILES
/var/lib/gap/workspace.gz: The system-wide GAP workspace. $HOME/gap/workspace.gz: The user-specific GAP workspace. SEE ALSO
gap(1), The `SaveWorkspace' function in the GAP manual. AUTHOR
Bill Allombert <ballombe@debian.org> NOTES
We are considering enabling the system-wide workspace per default, though this feature could be too confusing for old-time GAP users. If you have opinions about it, please mail <gap@packages.debian.org>. Debian July 2003 UPDATE-GAP-WORKSPACE(1)
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy