Sponsored Content
Top Forums Shell Programming and Scripting File comparison in UNIX columnwise Post 302906889 by prabhat.diwaker on Tuesday 24th of June 2014 09:11:41 AM
Old 06-24-2014
That is awesome..!!

Thanx pamu.! Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix comparison

I am very new to Unix. What are the similiarities and differences between ScoUnix and AIX5 if any? Where might i find the information? Which is better? (1 Reply)
Discussion started by: NewGuy100
1 Replies

2. Shell Programming and Scripting

rearranging the data in file (from columnwise to rowwise)

Hi I have one file which is having data like 10201 10202 10205 10206 10207 10208 10209 10210 10211 10213 10215 10801 10802 11406 11415 11422 11426 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11530 11604 11608 11611 11717 11718 11719 11722 11725... (3 Replies)
Discussion started by: reldb
3 Replies

3. UNIX for Dummies Questions & Answers

Comparison Unix and Windows file sysytem

i want to know the similarities and disimilarities of Unix and Windows file systems . methods of file , file orgsnization , meaning of file extension , file and disk fragments :confused::confused: (1 Reply)
Discussion started by: localp
1 Replies

4. Shell Programming and Scripting

Comparing files columnwise and print the differences in third file

Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue: I have 2 files say, File 1: a|4|7 b|3|2 c|8|8 d|8|9 File 2: a|4|6 b|2|2 c|8|8 d|9|8 The third file(output file) should have: Data mismatch in row 1 column 3 Data mismatch in row 2 coumn 2 Data... (3 Replies)
Discussion started by: abhijeet1409
3 Replies

5. Shell Programming and Scripting

Insert records in a file columnwise

Hello everyone!!!!! Need some help on inserting data in a file columnwise. Example: File1: 1|AAA|25|2 5|qqe|20|7 4|wer|31|81 I need to create a second file in which data can be inserted in a columnwise manner i.e. File2: AAA|25|1|2 qqe|20|5|7 wer|31|4|81 The order of columns in... (1 Reply)
Discussion started by: abhijeet1409
1 Replies

6. UNIX for Advanced & Expert Users

Insert records in a file columnwise

Hello everyone!!!!! Need some help on inserting data in a file columnwise. Example: File1: 1|AAA|25|2 5|qqe|20|7 4|wer|31|81 I need to create a second file in which data can be inserted in a columnwise manner i.e. File2: AAA|25|1|2 qqe|20|5|7 wer|31|4|81 The order of columns in... (1 Reply)
Discussion started by: abhijeet1409
1 Replies

7. Shell Programming and Scripting

Parse a File ColumnWise & Delete the Rows

Hi , I have a CSV file that has around 50K records in it. I have to delete all the duplicate rows from the file except one, depending upon data in column4. Lets say there are 3 rows for 'column4data' in the file. I have to retain only that line which has the smallest date value in column2.... (3 Replies)
Discussion started by: Sheel
3 Replies

8. Shell Programming and Scripting

Trim a file columnwise

Hi All, I want to trim each columns leading & trailing (like sql trim function) of a ',' separated file.. I've a file like this.. manab , c gi lucky , home babu , maa I want the output as manab,c gi lucky,home babu,maa A one liner would be a great help. (2 Replies)
Discussion started by: manab86
2 Replies

9. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies

10. Shell Programming and Scripting

UNIX file comparison

I have two files which has component name and version number separated by a space cat file1 com.acc.invm:FNS_PROD 94.0.5 com.acc.invm:FNS_TEST_DCCC_Mangment 94.1.6 com.acc.invm:FNS_APIPlat_BDMap 100.0.9 com.acc.invm:SendEmail 29.6.113 com.acc.invm:SendSms 12.23.65 cat file2 ... (8 Replies)
Discussion started by: rakeshtomar82
8 Replies
WICKED(7)																 WICKED(7)

NAME
wicked - a lua library for dynamic widgets in awesome SYNOPSIS
None DESCRIPTION
wicked is a library, written in lua, for easy creation and management of dynamic awesome statusbar widgets, from the rc.lua configuration file. USAGE
To use wicked, put require("wicked") at the top of your rc.lua, from then on, create your widgets as normal and call wicked.register() to register them to wicked. wicked.register(widget, widget_type, format, update_interval, data_field, padding) widget Use the widget created by widget for this argument. widget_type Enter one of the possible widget type functions or a customised one here, see the WIDGET TYPES section. format Format can be either a string argument where $1,$2,$3,etc. will be replaced by their respective values, or a function called with the arguments (widget, arguments), arguments being a table of the values otherwise inserted into the string, if it is a function, its return value will be used to populate the widget. Note that some widget types might not need or use this parameter. update_interval The amount of seconds it waits between updating this widget, defaults to 1. data_field If you want to feed the data into a graph or progressbar, put the bar or plot name you want to use in here. padding To prevent widgets jumping about your statusbar all the time, you can specify a padding value here, the number given here represents the minimum amount of digits that the widget's output has to contain (ie specifying 2 padds values under 10 with one zero, specifying 3 padds values under 100 with one zero and values under 10 with two zeros, etc) If the widget type supports it, you can specify a table with different numbers, the first number being the padding for the first value the type would return, the second number for the second value, etc. OTHER FUNCTIONS
The following functions are also provided by wicked. wicked.unregister(widget, keep) Unregister all updates associated with a widget. Keep is optional (defaults to false), and if true, the widget will only be suspended, ready to be reactivated by the activate function later. wicked.suspend() Suspend all widget updates, useful if you are running in low-power mode and want to save battery for a while. wicked.activate(widget) Restarts all widgets that were suspended either from wicked.suspend(), or by calling wicked.unregister() with keep=true. Widget is optional, if given, only that widget will be activated, defaults to all widgets. wicked.regregister(reg) wicked.register() and wicked.unregister() both return a reg object, this contains information about the widget and the updates that should be sent to it, you can pass this reg object into regregister after unregistering it, and it will be reregistered (or activated if it was only suspended). wicked.enable_caching(widget_type) Enable caching of the values returned by a custom widget_type. Note that all widget_type functions included in wicked already have caching enabled by default. WIDGET TYPES
Widget types consist of functions that take the "format" argument given to wicked.register as the first argument, the "padding" argument as the second, and return a table of values to insert in the format string, creators of custom widget types should note that the format argument may be a function as well as a string. For backwards compatibility purposes, if a string X is given as widget_type, it will use 'wicked.widgets.X' as the widget type. wicked.widgets.date The date widget type uses the output of the `os.date` command to populate the widget, if format is given, it will be passed as the FORMAT argument to `os.date`. wicked.widgets.cpu The cpu widget type outputs the current cpu usage in percentages, calculated over the duration of it's update_interval. Use $1 inside the format string to display the total usage percentage, $2 to show it for your first cpu core only, $3 for the second core, etc. wicked.widgets.mem The memory widget type outputs four things, $1 will be replaced with the current memory usage in percentages, $2 will be replaced with the total used memory in Mb, $3 with the total amount memory available to the system, and $4 with the amount of free memory. wicked.widgets.swap The swap widget type outputs the same values as the memory widget type, about the amount of swap in use/available. wicked.widgets.mpd The mpd widget type outputs the song currently playing on the music player daemon, note that the `mpc` application needs to be installed and configured in order to use this. wicked.widgets.mocp The mocp widget type outputs the song currently playing on the mocp server. Use $1 inside the format string to display the current song. A maxlength can be given to the wicked.register() function which will cut the songname in two when exeeded and displays the first and last part. A typical functioncall looks like this: wicked.register(mocpwidget, 'mocp', 'MOC: $1', 1, nil, 50). Here 50 is the max amount of characters displayed of $1. wicked.widgets.fs The fs widget type can display size and usage information about currently mounted filesystems, use ${mountpoint datatype} inside the format string to display that data, e.g. ${/ avail} displays the free space on the partition mounted on /. Available datatypes are 'used', 'size', 'usep' (Usage in %) and 'avail'. wicked.widgets.net The net widget type displays usage information about your networks, in the format string, ${interface type} will be replaced with with that value, possible types are: rx, tx, up, down. You can suffix the type with _b, _kb, _mb or _gb, to display the information in those units. wicked.widgets.uptime The uptime widget type displays information about how long your machine has been on (or "up"). Use $1 for the total number of seconds up, $2 for the number of days, $3 for the number of hours, $4 for the number of minutes and $5 for the number of seconds. CUSTOM TYPES
You can create your own custom widgets easily, an example of a widget that returns the output of a specific command is: mywidget = widget({ type = 'textbox', name = 'mywidget' }) function run_script() local filedescriptor = io.popen('my_nifty_script.py') local value = filedescriptor:read() filedescriptor:close() return {value} end -- Runs 'my_nifty_script.py' every 10 seconds and puts its output into the widget wicked.register(mywidget, run_script, "$1", 10) As you can see, the type function returns a table of values to insert into the format string, the first value in the table will be used in place of $1, the second in place of $2, etc. If you want to register the same function multiple times, it is a good idea to enable caching so that your function is only called once in each interval. To do this call the enable_caching function like so: wicked.enable_caching(run_script) FORMAT FUNCTIONS
You can use a function instead of a string as the format parameter, with this, you are able to check the value returned by wicked and change the output accordingly. The format function will get the widget as its first argument, and a table with the values otherwise inserted into the format string as its second argument, and should return the text to be used for the widget. An example that uses a format function in order to hide the mpd widget when there is no song playing: mpdwidget = widget({ type = 'textbox', name = 'mpdwidget' }) wicked.register(mpdwidget, wicked.widgets.mpd, function (widget, args) if args[1]:find("volume:") == nil then return ' <span color="white">Now Playing:</span> '..args[1] else return '' end end) USAGE EXAMPLES
Put these snippets into your rc.lua (usually located at ~/.config/awesome/rc.lua) to see what they do, don't forget to add the widgets to your statusbar. A simple 'Now Playing' widget mpdwidget = widget({ type = 'textbox', name = 'mpdwidget' }) wicked.register(mpdwidget, wicked.widgets.mpd, ' <span color="white">Now Playing:</span> $1') A memory usage monitor, with padding memwidget = widget({ type = 'textbox', name = 'memwidget' }) wicked.register(memwidget, wicked.widgets.mem, ' <span color="white">Memory:</span> $1 ($2Mb/$3Mb)', {2, 4, 4}) A filesystem usage indicator fswidget = widget({ type = 'textbox', name = 'fswidget' }) wicked.register(fswidget, wicked.widgets.fs, ' <span color="white">FS:</span> ${/ used}/${/ size} (${/ usep} used)', 120) A network interface monitor (for eth0) netwidget = widget({ type = 'textbox', name = 'netwidget' }) wicked.register(netwidget, wicked.widgets.net, ' <span color="white">NET</span>: ${eth0 down} / ${eth0 up} [ ${eth0 rx} // ${eth0 tx} ]') SEE ALSO
awesome(1) awesomerc(5) AUTHORS
Lucas de Vries <lucas@glacicle.com[1]> NOTES
1. lucas@glacicle.com mailto:lucas@glacicle.com 06/11/2012 WICKED(7)
All times are GMT -4. The time now is 07:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy