Sponsored Content
Top Forums Shell Programming and Scripting awk - How to preserve whitespace? Post 302767377 by Chubler_XL on Wednesday 6th of February 2013 06:30:18 PM
Old 02-06-2013
Still unhappy with my solution, think this works much better:

Code:
awk '
function rep(a,v) {
  sub("^(([^ \t]+[ \t]+){"a-1"})","&" SUBSEP);
  sub(SUBSEP "[^ \t]+", v);
}   
/^\// {
    rep(3,"13")
    rep(4,"*")
    rep(5,"$W1")
} 1' newsyslog.conf


Last edited by Chubler_XL; 02-06-2013 at 07:49 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to assign value to variable using awk coz of whitespace in value

Unix gurus, I have a file as below, which is basically the result set obtained from a sql query on an Oracle database. ID PROG_NAME USER_PROG_NAME -------- --------------- ---------------------------------------- 33045 INCOIN Import Items 42690 ... (3 Replies)
Discussion started by: sunpraveen
3 Replies

2. Shell Programming and Scripting

How to match (whitespace digits whitespace) sequence?

Hi Following is an example line. echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:" I want it's output to be 200 However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Discussion started by: shahanali
3 Replies

3. Shell Programming and Scripting

Preserve space in variable of AWK

This seems to be a stupid basic question, but I cant get the space to stick in the awk variable. I do use this command to grep a time range of the log file. cat /var/log/daemon.log | awk '$0>=from&&$0<=to' from="$(date +%b" "%e" "%H:%M:%S -d -24hour)" to="$(date +%b" "%e" "%H:%M:%S)" I now... (9 Replies)
Discussion started by: Jotne
9 Replies

4. Shell Programming and Scripting

Date Format - preserve whitespace

I am trying to change the date format for the following: YESTER=`TZ=aaa24 date +%b" "%d | sed 's/0/ /'` TraceList=$(ls -ltR /pdt/logs | grep "$YESTER" | awk '{print $9}') CMD2=$(find /disk/dan/dansFiles/pass/logs/$TList -name cmd\* -prune) what I am trying to do in the above... (1 Reply)
Discussion started by: ther2000
1 Replies

5. Shell Programming and Scripting

Preserve trailing whitespace in variable

Hello, I wondering how I can echo a string without having the trailing whitespace removed. For example I have a string str="TESTING123 " that I need to hash using sha1. I get the correct answer when I run the line below from the terminal $ echo -n "TESTING123 " | openssl sha1... (3 Replies)
Discussion started by: colinireland
3 Replies

6. UNIX for Dummies Questions & Answers

[Solved] How remove leading whitespace from xml (sed /awk?)

Hi again I have an xml file and want to remove the leading white space as it causes me issues later in my script I see sed is possible but cant seem to get it to work I tried sed 's/^ *//' file.xml output <xn:VsDataContainer id="1U104799" modifier="update"> ... (10 Replies)
Discussion started by: aniquebmx
10 Replies

7. Shell Programming and Scripting

How to preserve spaces in input fields with awk?

I'm trying to do something pretty simple but its appears more complicated than expected... I've lines in a text file, separated by the comma and that I want to output to another file, without the first field. Input file: file1,item, 12345678 file2,item, 12345678 file2,item, ... (8 Replies)
Discussion started by: Armoric
8 Replies

8. Shell Programming and Scripting

Awk: Dealing with whitespace in associative array indicies

Is there a reliable way to deal with whitespace in array indicies? I am trying to annotate fails in a database using a table of known fails. In a begin block I have code like this: # Read in Known Fail List getline < "'"$failListFile"'"; getline < "'"$failListFile"'"; getline <... (6 Replies)
Discussion started by: Michael Stora
6 Replies

9. Shell Programming and Scripting

awk to ignore whitespace in field

The awk below executes and update the desired field in my first awk. However, the white space between nonsynonymous SNV in $9 is being split into tabs and my attempt to correct this does not update the field unless it is removed. I am not sure what I am doing wrong? Thank you :). file1 ... (4 Replies)
Discussion started by: cmccabe
4 Replies

10. Shell Programming and Scripting

awk sed to repeat every character on same position from the upper line replacing whitespace

Hello is it possible with awk or sed to replace any white space with the previous line characters in the same position? I am asking this because the file I have doesn't always follow a pattern. For example the file I have is the result of a command to obtain windows ACLs: icacls C:\ /t... (5 Replies)
Discussion started by: nakaedu
5 Replies
mdtool(1)						      General Commands Manual							 mdtool(1)

NAME
mdtool - MonoDevelop Application Runner SYNOPSIS
mdtool <applicationId> ... mdtool setup ... mdtool -q DESCRIPTION
mdtool is a tool that can execute head-less MonoDevelop applications, this can be used for example to do batch compilations without start- ing up the MonoDevelop GUI. USAGE
applicationId ... Runs the specified application. -q Lists available applications. Available Applications The list of applications returned by the option -q might be different depending on which add-ins are installed. gsetup Graphical add-in setup utility. build [options] [project-file] Project build tool. Use this tool to build any solution supported by MonoDevelop (eg. .mds, .sln). If no solution/project is speci- fied then it will pull the first solution it can find in the current directory. You can use this option to build packages in a head-less or batch fashion. Options -c , --configuration:CONFIGURATION Name of the solution configuration to build. -t , --target:TARGET Name of the target: Clean or Build -p , --project:PROJECT Name of the project to build. dbgen Parser database generation tool. project-export Project conversion tool. IDE The MonoDevelop IDE. generate-makefiles <solution-file> [--simple-makefiles] [-d:default-config] Makefile generator tool. This can be used to generate makefiles from any solution supported by MonoDevelop. Options --simple-makefiles , -s Generates set of Makefiles with the most common targets, and a configuration script that does a basic check of package dependencies. Default is to generate Makefile structure based on Autotools with the standard targets and configuration scripts. -d:default-config Configuration that the Makefile will build by default. Other configurations can be selected via the '--con- fig' or '--enable-*' option of the generated configure script. setup command [arg1, .., argn2] Runs the MonoDevelop add-in setup command. You must specify a command to execute. If none is provided a list of commands is dis- played Add-in Commands install (i) [package-name|package-file] Installs an add-in or set of addins. The command argument is a list of files and/or package names. If a package name is provided the package will be looked out in the registered repositories. A specific add- in version can be specified by appending it to. the package name using MonoDevelop.SourceEditor/0.9.1 uninstall (u) [package-name] Uninstalls an add-in. The command argument is the name of the add-in to uninstall. check-install (ci) Checks if a package is installed. If it is not, it looks for the package in the registered repositories, and if found the package is downloaded and installed, including all needed dependencies. update (up) Downloads and installs available updates for installed add-ins. list (l) Prints a list of all installed add-ins. list-av (la) Prints a list of add-ins available to install in the registered repositories. list-update (lu) Prints a list of available add-in updates in the registered repositories. Repository Commands rep-add (ra) url1 [url2 [url2]] Registers an add-in repository. Several URLs can be provided. rep-remove (rr) url1 [url2 [url2]] Unregisters an add-in repository. Several URLs can be provided. rep-update (ru) Updates the lists of addins available in all registered repositories. rep-list (rl) Shows a list of all registered repositories. Add-in Registry Commands: reg-update (rgu) Looks for changes in add-in directories and updates the registry. New add-ins will be added and deleted add-ins will be removed. reg-build (rgu) info [filename|package-name] Prints information about an add-in. Packaging Commands rep-build (rb) path Scans the provided directory and generates a set of index files with entries for all add-in packages found in the directory tree. The resulting file structure is an add-in repository that can be published in a web site or a shared directory. pack (p) file-path Creates an add-in package (.mpack file) which includes all files needed to deploy an add-in. The command parameter is the path to the add-in's configuration file. help (h) [command] Shows help for the given command Debug Commands: dump-file Prints the contents of a registry file for debugging. SEE ALSO
monodevelop(1), mono(1), mcs(1) COPYRIGHT
Copyright (C) 2007 Novell, Inc (http://www.novell.com) MAILING LISTS
Visit http://lists.ximian.com/mailman/listinfo/monodevelop-list for details. WEB SITE
Visit http://www.monodevelop.com for details mdtool(1)
All times are GMT -4. The time now is 07:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy